-
-
Notifications
You must be signed in to change notification settings - Fork 637
Open
Labels
Description
I anticipated that the last row of the table would be merged using colSpan, but it doesn't seem to work.
Example of the code
const handleViewPDF = () => {
const raw = [
{ name: 'Torrey Becker', email: '[email protected]', city: 'Cremin bury' },
{ name: 'Jared Corwin', email: '[email protected]', city: 'Bergstrom land' },
{ name: 'Jocelyn Zboncak', email: '[email protected]', city: 'Fritsch town' },
{ name: 'Emilio Wyman', email: '[email protected]', city: 'North Noah mouth' },
{ name: '_Torrey Becker', email: '[email protected]', city: 'Cremin bury' },
{ name: '_Jared Corwin', email: '[email protected]', city: 'Bergstrom land' },
{ name: '_Jocelyn Zboncak', email: '[email protected]', city: 'Fritsch town' },
{ name: '_Emilio Wyman', email: '[email protected]', city: 'North Noah mouth' },
];
// eslint-disable-next-line
const doc = new jsPDF('p', 'pt');
const body = [];
// eslint-disable-next-line
for (let i = 0; i < raw.length; i += 1) {
const row = [];
// eslint-disable-next-line
for (let key in raw[i]) {
row.push(raw[i][key]);
}
body.push(row);
}
body.push({
colSpan: 3,
content: 'Merged (colSpan=3)',
styles: { valign: 'middle', halign: 'center' },
});
doc.autoTable({
startY: 60,
body,
theme: 'grid',
});
doc.save(`report.pdf`);
};
the PDF created
