Skip to content

Commit 920dcd1

Browse files
authored
Merge pull request #255 from misleadingTitle/master
added a (maybe partial) solution to issue 99. i wasn't able to create an appropriate test
2 parents 77511b3 + e83a331 commit 920dcd1

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

lib/stream/xlsx/worksheet-writer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ WorksheetWriter.prototype = {
187187
// we _cannot_ accept new rows from now on
188188
this._rows = null;
189189

190+
if (!this.startedData) {
191+
this._writeOpenSheetData();
192+
}
190193
this._writeCloseSheetData();
191194
this._writeMergeCells();
192195

5.85 KB
Binary file not shown.

spec/integration/issues.spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,23 @@ var TEST_XLSX_FILE_NAME = './spec/out/wb.test.xlsx';
1111

1212

1313
describe('github issues', function() {
14+
it('issue 99 - Too few data or empty worksheet generate malformed excel file', function() {
15+
var testutils = require('../utils/index');
16+
var options = {
17+
filename: './spec/integration/data/test-issue-99.xlsx',
18+
useStyles: true,
19+
useSharedStrings: true
20+
};
21+
var wb = new Excel.stream.xlsx.WorkbookWriter(options);
22+
var sheet = wb.addWorksheet("test");
23+
sheet.commit();
24+
wb.commit();
25+
26+
var wb2 = new Excel.Workbook();
27+
wb2.xlsx.readFile('./spec/integration/data/test-issue-99.xlsx');
28+
throw Error("check the file is correclty opened by excel");
29+
30+
});
1431
it('issue 163 - Error while using xslx readFile method', function() {
1532
var wb = new Excel.Workbook();
1633
return wb.xlsx.readFile('./spec/integration/data/test-issue-163.xlsx')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy