Closed
Description
🐛 Bug Report
WorkbookWriter(WorkSheetWriter) sheems that doesn't support headerFooter and rowBreaks.
Lib version: 3.9.0
Steps To Reproduce
const workbookWriterOption1 = <ExcelJS.stream.xlsx.WorkbookWriterOptions>{
stream: new stream.PassThrough(),
filename: null,
useStyles: true,
useSharedStrings: true
};
const workBook1 = new ExcelJS.stream.xlsx.WorkbookWriter(workbookWriterOption1);
const workSheet1 = workBook1.addWorksheet('ActionCorrespondencesViews',
<ExcelJS.AddWorksheetOptions>{
pageSetup: {
printTitlesRow: "1:4",
printTitlesColumn: "A:A",
paperSize: 9, // A4
orientation: 'landscape'
},
views:
[<ExcelJS.WorksheetViewFrozen>{ state: 'frozen', xSplit: 5, ySplit: 4, topLeftCell: 'F5', activeCell: 'A1' }]
});
const headerRow1 = workSheet1.addRow([.........]);
workSheet1.lastRow.addPageBreak();
The expected behaviour:
TypeError Exception is caused.
Possible solution (optional, but very helpful):
The workaround for exception is the following code.
BUT, When printing the generated xlsx with MS-EXCEL, neither HeaderFooter nor rowBreaks was set.
// Workaround : UnhandledPromiseRejectionWarning: TypeError: Cannot set property 'oddFooter' of undefined
workSheet1.headerFooter = <ExcelJS.HeaderFooter>{ oddFooter: "&P/&N" }; // Set the footer (default centered) to bold, resulting in: "Page 2 of 16"
// Workaround : UnhandledPromiseRejectionWarning: TypeError: Cannot set property 'rowBreaks' of undefined
workSheet1.pageSetup["rowBreaks"] = workSheet1["rowBreaks"] = [];