1.4.8 broke writing Excel files with useSharedStrings:true
papandreou opened this issue · comments
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:
Clicking "yes" results in an empty spreadsheet.
Disabling useSharedStrings
makes it work again.
Looks like exceljs can read the file, though.
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
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!');
});