gitbrent / PptxGenJS

Create PowerPoint presentations with a powerful, concise JavaScript API.
https://gitbrent.github.io/PptxGenJS/
MIT License
2.62k stars 611 forks source link

Extra table cells generated when using `colspan` > 1 in Node.js #1290

Open fallon-evernorth opened 10 months ago

fallon-evernorth commented 10 months ago

We appreciate your feedback - to help the team understand your needs please complete the following template to ensure we have the details to help.

Submission Guidelines

Issue Category

Product Versions

Desired Behavior

When using the colspan option and setting the value >1 (ex. for cells in a header row), there should not be extra empty cells or entire empty columns generated.

Observed Behavior

Extra empty cells generated.

(I am getting a 403 forbidden here when attempting to upload a screenshot.)

Steps to Reproduce

Example code run in Node.js:

const pptxGenJS = new PptxGenJS();
let pptSlide = pptxGenJS.addSlide();

let arrTabRows1 = [
    [
        { text: 'A1\nA2', options: { rowspan: 2, fill: { color: '99FFCC' } } },
        { text: 'B1' },
        { text: 'C1 -> D1', options: { colspan: 2, fill: { color: '99FFCC' } } },
        { text: 'E1' },
        { text: 'F1\nF2\nF3', options: { rowspan: 3, fill: { color: '99FFCC' } } }
    ],
    [{text:'B2'}, {text:'C2'},{text:'D2'}, {text:'E2'}],
    [{text:'A3'}, {text:'B3'}, {text:'C3'}, {text:'D3'}, {text:'E3'}]
];

pptSlide.addTable(arrTabRows1, newOptions);

const newOptions = {
    x: 0.67,
    y: 1.1,
    w: '90%',
    h: 2,
    fill: { color: 'F9F9F9' },
    color: '3D3D3D',
    fontSize: 16,
    border: { pt: 4, color: 'FFFFFF' },
    align: 'center',
    valign: 'middle'
};

pptxGenJS.writeFile({
            fileName: `test.pptx`
});