Bug 43071 - Read/write problems on Excel files containing charts
Summary: Read/write problems on Excel files containing charts
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-FINAL
Hardware: PC Windows XP
: P2 critical with 4 votes (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2007-08-09 05:31 UTC by Tanja Zwick
Modified: 2008-12-29 23:29 UTC (History)
0 users

Excel input file containing a chart sheet (13.50 KB, application/vnd.ms-excel)
2007-08-09 05:36 UTC, Tanja Zwick
Damaged Excel output file generated by POI-HSSF (14.00 KB, application/vnd.ms-excel)
2007-08-09 05:38 UTC, Tanja Zwick
This is the original file (32.50 KB, application/octet-stream)
2007-10-11 20:57 UTC, Khanh Tran
This is the damaged file (33.00 KB, application/vnd.ms-excel)
2007-10-11 20:58 UTC, Khanh Tran

Note You need to log in before you can comment on or make changes to this bug.
Description Tanja Zwick 2007-08-09 05:31:35 UTC
Overview Description: 
When creating a workbook from an Excel file that contains a chart and
immediately writing the workbook to an output stream without performing any
manipulations, the resultung Excel file is damaged. This occurs only if the
chart contained in the input file is a seperate sheet (and not a part of a table
sheet) and followed by another sheet.

Steps to Reproduce: 
The problem arises when executing the following lines of code.

File inputFile = new File( "InputFile.xls" );
File directory = new File( "Temp" );
File outputFile = File.createTempFile( "OutputFile.", ".xls", directory );       

POIFSFileSystem fileSystem = new POIFSFileSystem( 
new FileInputStream( inputFile ) );
HSSFWorkbook workbook = new HSSFWorkbook( fileSystem );
HSSFSheet sheet = workbook.getSheetAt( 0 );
FileOutputStream outputStream = new FileOutputStream( outputFile );
workbook.write( outputStream );

Actual Results: 
When trying to open the output file in Excel, the following error messages are

"Kann Datei nicht lesen." -> Return
"Kann Datei nicht lesen." -> Return
"In Datei 'OutputFile.39744.xls' wurden Fehler festgestellt.
Die folgenden Reparaturen wurden durchgeführt:
Die Datei war so stark beschädigt, dass sie nicht repariert werden konnte. Excel
hat versucht, Ihre Formeln und Zahlen wieder herzustellen, aber einige Daten
sind möglicherweise verloren gegangen."

Expected Results:
The output file schould have the same content as the input file. There should be
no differences between them when opening the files in Excel.

Build Date & Platform: 
Build 2007-07-31 on Windows XP Professional, Version 2002, SP 2

Additional Builds and Platforms:

Additional Information:
This bug is similar to 10943.
Comment 1 Tanja Zwick 2007-08-09 05:36:42 UTC
Created attachment 20622 [details]
Excel input file containing a chart sheet
Comment 2 Tanja Zwick 2007-08-09 05:38:08 UTC
Created attachment 20623 [details]
Damaged Excel output file generated by POI-HSSF
Comment 3 Khanh Tran 2007-10-11 20:56:19 UTC
I am facing the same problem, althrough my file doesn't contains any chart.
Another case, I created a file and insert some charts, it works file.
So, the problem isn't on the chart.
Comment 4 Khanh Tran 2007-10-11 20:57:34 UTC
Created attachment 20967 [details]
This is the original file
Comment 5 Khanh Tran 2007-10-11 20:58:49 UTC
Created attachment 20968 [details]
This is the damaged file
Comment 6 nlonga 2007-12-03 06:04:03 UTC
Maybe the same bug as 44010 ?
Comment 7 Yegor Kozlov 2008-12-29 23:29:56 UTC
The reported problem is not reproducible with the latest trunk.
Please try the latest 3.5-beta4 or download daily builds from