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

1.4.8 broke writing Excel files with useSharedStrings:true #581

Closed
papandreou opened this issue Jun 1, 2018 · 3 comments
Closed

1.4.8 broke writing Excel files with useSharedStrings:true #581

papandreou opened this issue Jun 1, 2018 · 3 comments

Comments

@papandreou
Copy link
Contributor

The below program produced a readable file with exceljs 1.4.7:

const Excel = require('exceljs');

(async () => {
  const workbook = new Excel.stream.xlsx.WorkbookWriter({
    filename: 'ohno.xlsx',
    useSharedStrings: true
  });

  const worksheet = workbook.addWorksheet('myWorksheet');
  const sheetRow = worksheet.addRow(['Hello']);
  sheetRow.commit();

  worksheet.commit();
  await workbook.commit();
})();

With 1.4.8 the file cannot be opened in Excel:

screen shot 2018-06-01 at 18 26 00

Clicking "yes" results in an empty spreadsheet.

Disabling useSharedStrings makes it work again.

@papandreou
Copy link
Contributor Author

Looks like exceljs can read the file, though.

@guyonroche
Copy link
Collaborator

I'd fixed an issue caused by 1.4.7 - but forgot to fix it in WorkbookWriter.
Just published fix for this in 1.4.9

@cncaihong
Copy link

cncaihong commented Oct 16, 2018

Hi, 1.6.2 has the same problem.
The code snippet :

    const Excel = require('exceljs');
    let workbook = new Excel.stream.xlsx.WorkbookWriter({
        filename: `test.xlsx`,
        useStyles: true,
    });

    let workSheet = workbook.addWorksheet('Test');
 
    // add rows by key-value
    let workRow = workSheet.addRow({name: 'xiaohong', cost: '金融', money: '1000'});

    workRow.commit();
    workSheet.commit();
    workbook.commit()
        .then(function() {
            console.log('Excel export complete!');
        });

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

3 participants