Bug 47089 - XSSFWorkbook.createSheet(...) corrupts Excel file
Summary: XSSFWorkbook.createSheet(...) corrupts Excel file
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.5-dev
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-23 19:38 UTC by Matthew
Modified: 2009-04-24 11:27 UTC (History)
0 users



Attachments
original.xlsm (16.61 KB, application/vnd.ms-excel.sheet.macroenabled.12)
2009-04-23 19:38 UTC, Matthew
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew 2009-04-23 19:38:02 UTC
Created attachment 23533 [details]
original.xlsm

I use following codes to read an Excel 2007 file and create a worksheet in it, but the output file cannot be opened by MS Excel (prompt error and need recovery).

--

Workbook sourceWb = (read "original.xlsm")
sourceWb.createSheet("Sample");
sourceWb.write(new FileOutputStream("output.xlsm"));		

--

Please check the attached "original.xlsm" for testing. Thanks.
Comment 1 Yegor Kozlov 2009-04-24 11:27:27 UTC
Fixed in r768389

The sequence of sheetId of existing sheets was not continuous. This bug resulted in a duplicate sheetId making the output unreadable. 

Yegor