https://issues.apache.org/bugzilla/show_bug.cgi?id=49874
Summary: Problems with names when removing a sheet from an HSSF
workbook
Product: POI
Version: 3.7-dev
Platform: PC
Status: NEW
Severity: normal
Priority: P2
Component: HSSF
AssignedTo: [email protected]
ReportedBy: [email protected]
Created an attachment (id=25979)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=25979)
Zip file with the mentioned workbooks (Test.xls and Test.xlsx)
I have an Excel file with three sheets called AAA, BBB, CCC. On each of them
there is a name defined: AA on AAA, BB on BBB, CC on CCC. If I'm now removing
sheet BBB, the behaviour for a HSSF workbook is different than for a XSSF
workbook. The following is what I observe:
- HSSF: Sheets AAA and CCC remain (which is ok), but left are only names AA and
BB. This is strange. I would understand if BB would be missing but CC should
definitely still be around I guess. Also, if you open the file with an older
version of Excel (< 2007) you are confronted with a dialog saying that the file
has been repaired. Excel 2007+ seems to do that behind the scenes.
- XSSF: Sheets AAA and CCC remain (again, this is ok), and so do the names AA
and CC. This behaviour seems ok to me.
Please find a snippet of code that can be used to reproduce the problem:
Workbook wb = WorkbookFactory.create(new
FileInputStream("C:/Users/mstuder/Documents/Test.xls"));
wb.removeSheetAt(wb.getSheetIndex("BBB"));
wb.write(new FileOutputStream("C:/Users/mstuder/Documents/Test2.xls"));
Also, please find attached the two corresponding Excel files (*.xls and
*.xlsx).
OS: Windows 7
POI: 3.7-beta2
Java: 1.6.0_20 64-bit
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]