Bug 47089

Summary: XSSFWorkbook.createSheet(...) corrupts Excel file
Product: POI Reporter: Matthew <matthew.knl>
Component: XSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: major    
Priority: P2    
Version: 3.5-dev   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Attachments: original.xlsm

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