Bug 29619 - Excel file becomes corrupt after sheet deletion
Summary: Excel file becomes corrupt after sheet deletion
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.0-FINAL
Hardware: PC All
: P1 major with 6 votes (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2004-06-16 18:17 UTC by Matthieu Ursenbach
Modified: 2010-06-03 07:19 UTC (History)
0 users

All the files are in his archive (30.98 KB, application/zip)
2004-06-16 18:20 UTC, Matthieu Ursenbach

Note You need to log in before you can comment on or make changes to this bug.
Description Matthieu Ursenbach 2004-06-16 18:17:07 UTC
Environment:	W2K-SP4
		Excel 2000 9.0.6926 SP-3
		POI2.0 Final

Bug report:		

1) The following test set works systematically:
First I create with Excel my template file called 'testDeletionIn.xls'
There are 3 sheets in this file 'A', 'Graph' and 'B'. Both 'A' and 'B' sheets 
are almost empty but 'Graph' contains a shart.

The template file is used to generate 3 different output files 
	'testDeletionOut1.xls' in wich sheet 'Graph' is deleted
	'testDeletionOut2.xls' in wich sheet 'A' is deleted
	'testDeletionOut3.xls' in wich sheet 'B' is deleted

All this generated files are readable with Excel but in 'testDeletionOut2.xls' 
the shart values are redirected in sheet 'B'.
It's not a significant bug because it depend the ordre in wich I remove the 

2) The test continues :
A single macro is added into a copy of 'testDeletionIn.xls'
I retry deletion test on this file called 'testDeletionInMacro.xls' to 
obtain 'testDeletionOutMacro1.xls', 'testDeletionOutMacro2.xls' 
and 'testDeletionOutMacro3.xls'

In this case, I cannot open any of this files with Excel. 
The error message looks like :
  "EXCEL.exe has generated errors and will be closed by windows.  
   You need to restart the program.  
   An error log..."
Comment 1 Matthieu Ursenbach 2004-06-16 18:20:04 UTC
Created attachment 11859 [details]
All the files are in his archive
Comment 2 Matthieu Ursenbach 2004-08-04 15:29:39 UTC
Does somebody have reproduces it?
Comment 3 Fran 2005-03-14 09:55:13 UTC
(In reply to comment #2)
> Does somebody have reproduces it?

I have the same problem. I use a book with macros and charts and if i try to 
remove a sheet, i can´t open the result book, whith the same error described 
Comment 4 Andy Oliver 2005-03-14 15:42:18 UTC
That makes sense seeing that HSSF isn't going to delete any attached references
of things it doesn't understand.
Comment 5 Nguyen Dang Lu 2006-02-03 02:50:38 UTC
When I use Microsoft Office 2003, it is really OK. But the error is raised with 
Microsoft Office 2000, it corrupt (memory error) to open workbook. removeSheetAt
() method seem works well if the sheet has not any Graph.
Comment 6 Nick Burch 2010-06-03 07:19:02 UTC
This bug references a very old version of POI. As no new comments have been added in a long time, I'm assuming that this bug has now been fixed

If the bug still exists with the latest version of POI, please re-open the bug and add a comment indicating this, ideally also with a failing unit test