simonbengtsson / jsPDF-AutoTable

jsPDF plugin for generating PDF tables with javascript
https://simonbengtsson.github.io/jsPDF-AutoTable/
MIT License
2.33k stars 624 forks source link

Problem with horizontalPageBreak with colspan column header #1032

Open first5455 opened 9 months ago

first5455 commented 9 months ago

Hi. I have a problem with colspan column when use with horizontalPageBreak. I expected that header3 will repeat when horizontalPageBreak to another page. Any idea?

image_2024-02-07_131425624 image_2024-02-07_131510585

I set data of header like this or maybe I do it wrong?

const daylist = ['day1'........]
const headers = [
            [
                {
                    content: "header1",
                    rowSpan: 2,
                    styles: {halign: "left", valign: "middle", minCellWidth: 50},
                },
                {
                    content: "header2",
                    rowSpan: 2,
                    styles: {halign: "left", valign: "middle", minCellWidth: 500},
                },
                {
                    content: "header3",
                    colSpan: daylist.length,
                    styles: {halign: "left", valign: "middle"},
                },
            ],
            daylist,
        ];

doc.setFont("Arial Unicode MS");
        doc.autoTable({
            head: headers,
            body: rows.map((row) => Object.values(row)),
            styles: {
                font: "Arial Unicode MS",
                halign: "center",
                overflow: "linebreak",
            },
            horizontalPageBreak: true,
            horizontalPageBreakBehaviour: "immediately",
            horizontalPageBreakRepeat: [0, 1],
            tableWidth: "warp",
            pageBreak: "avoid",
            rowPageBreak: "auto",
        });
samuiii commented 9 months ago

i got problem same ++

theydl-vijay commented 4 months ago

i got the same issue here @simonbengtsson

image

aaronmg241 commented 3 months ago

Same issue here.

theydl-vijay commented 3 months ago

Same issue here.

Did you find any solution?