Bug 17475

Summary: Removal of sheets with diagrams corrupts file
Product: POI Reporter: Henning Boeger <ndz43wv02>
Component: HSSFAssignee: POI Developers List <dev>
Severity: major    
Priority: P3    
Version: 3.0-dev   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Excel file for reproducing the bug

Description Henning Boeger 2003-02-27 11:32:26 UTC
If I use Methode removeSheetAt on a sheet which contains a diagram, Excel 2000 
SR-1 crashed when opening the modified file.

The original Excel file is a simple book created from scratch. It contains two 
sheets, each containing one simple line diagram.

The code to read, modify and write the file is as follows:

HSSFWorkbook book = new HSSFWorkbook(new FileInputStream(path));
FileOutputStream fOut = new FileOutputStream(path);

The POI version I use is
Comment 1 Jason Height 2003-02-27 21:11:41 UTC
Upload the excel file as well as providing a small piece of code that uses the 
template to generate the error.
Comment 2 Henning Boeger 2003-03-03 14:30:49 UTC
Created attachment 5118 [details]
Excel file for reproducing the bug
Comment 3 Henning Boeger 2003-03-03 14:37:15 UTC
The following code produces a corrupt(?) excel file by modifying the attached 
template file (using jakarta-poi-1.11.0-dev-20030225.jar).

Note: When opening the resulting "out.xls", Excel does not crash immediately, 
but behaves strangely. I cannot select the sheet, the diagram is empty. If I 
try to change the diagram's source fields, Excel crashes.

import java.io.FileInputStream;
import java.io.FileOutputStream;

import org.apache.poi.hssf.usermodel.HSSFWorkbook;

public class SimpleExcelTest {
	public static void main(String[] args) throws Exception {
		HSSFWorkbook book = new HSSFWorkbook(new FileInputStream
		FileOutputStream fOut = new FileOutputStream("out.xls");
Comment 4 Andy Oliver 2003-07-24 15:50:32 UTC
complicated.  put off till 3.0.
Comment 5 Yegor Kozlov 2009-04-17 11:32:19 UTC
The problem is not reproducible with the latest trunk.  

Please try the latest svn version .
Daily builds are available at