File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -187,6 +187,9 @@ WorksheetWriter.prototype = {
187
187
// we _cannot_ accept new rows from now on
188
188
this . _rows = null ;
189
189
190
+ if ( ! this . startedData ) {
191
+ this . _writeOpenSheetData ( ) ;
192
+ }
190
193
this . _writeCloseSheetData ( ) ;
191
194
this . _writeMergeCells ( ) ;
192
195
Original file line number Diff line number Diff line change @@ -11,6 +11,23 @@ var TEST_XLSX_FILE_NAME = './spec/out/wb.test.xlsx';
11
11
12
12
13
13
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
+ } ) ;
14
31
it ( 'issue 163 - Error while using xslx readFile method' , function ( ) {
15
32
var wb = new Excel . Workbook ( ) ;
16
33
return wb . xlsx . readFile ( './spec/integration/data/test-issue-163.xlsx' )
You can’t perform that action at this time.
0 commit comments