Adding Headers/Footers to a Worksheet
Adding headers and footers to a worksheet
import { createExcelFile, createWorkbook } from 'excel-builder-vanilla';
const originalData = [
['Artist', 'Album', 'Price'],
['Buckethead', 'Albino Slug', 8.99],
['Buckethead', 'Electric Tears', 13.99],
['Buckethead', 'Colma', 11.34],
['Crystal Method', 'Vegas', 10.54],
['Crystal Method', 'Tweekend', 10.64],
['Crystal Method', 'Divided By Night', 8.99],
];
const artistWorkbook = createWorkbook();
const albumList = artistWorkbook.createWorksheet({ name: 'Album List' });
albumList.setData(originalData); // <-- Here's the important part
albumList.setHeader([
'This will be on the left',
['In the middle', { text: 'I shall be', bold: true }],
{ text: 'Right, underlined and size of 16', font: 16, underline: true },
]);
albumList.setFooter(['Date of print: &D &T', '&A', 'Page &P of &N']);
artistWorkbook.addWorksheet(albumList);
const data = createExcelFile(artistWorkbook);
downloader('Artist WB.xlsx', data);NodeJS Usage Example
Last updated