Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] WorkbookWriter doesn't support headerFooter and rowBreaks. #1248

Closed
master-maintenance1-peer-connect opened this issue May 2, 2020 · 4 comments
Assignees

Comments

@master-maintenance1-peer-connect

🐛 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"] = [];
@Alanscut
Copy link
Member

Alanscut commented May 7, 2020

@master-maintenance1-peer-connect See PR #1232 , Support 'rowbreaks' function, I will submit PR as soon as possible.

@master-maintenance1-peer-connect
Copy link
Author

Fine! is Pull-request version 4.0 ? And, When it can get by "npm install" ?

@Alanscut
Copy link
Member

Alanscut commented May 11, 2020

@master-maintenance1-peer-connect This requires the approval of members and authors. I don't have permission to merge code and release versions .

@master-maintenance1-peer-connect
Copy link
Author

master-maintenance1-peer-connect commented May 29, 2020

The "NPMJS.com release versions" are incorrect.
There is a conflict between the versions of the files that could be installed from npmjs.com.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants