Skip to content

[BUG] line-break in table header generates error in Excel for Mac #2134

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

Open
patrick-hertling opened this issue Sep 16, 2022 · 1 comment
Open

Comments

@patrick-hertling
Copy link

🐛 Bug Report

Using line break characters in the header of a table generates an error when trying to open the generated file on Mac.

Lib version: 4.2.1

Steps To Reproduce

        const workbook = new ExcelJS.Workbook();

        const worksheet = workbook.addWorksheet(title, {
            properties: {
                defaultColWidth: 30,
            },
            pageSetup: {
                paperSize: 9,
                orientation: 'landscape',
            },
        });

        worksheet.addTable({
            name: 'table',
            ref: 'A1',
            headerRow: true,
            style: {
                theme: 'TableStyleLight2',
                showRowStripes: true,
            },
            columns: [
                { name: 'Test\r\nmultiple\r\nlines' },
            ],
            rows: [
                ['Test'],
            ],
        });

        worksheet.getCell('A1').alignment = { wrapText: true };

        await workbook.xlsx.writeFile('test.xlsx');

The expected behaviour:

After the file gets stored, we can open it and see its content.

The actual behaviour:

An error pops up:

Screenshot 2022-09-16 at 15 29 52

Screenshot 2022-09-16 at 15 30 12

@patrick-hertling
Copy link
Author

Is only Mac affected by this? Has anybody found this happening in another OS?

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

No branches or pull requests

1 participant