Bug 46840 - Can't open Office 97 XLS which has been edited with Office 2007
Summary: Can't open Office 97 XLS which has been edited with Office 2007
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.5-dev
Hardware: PC Windows Vista
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2009-03-12 00:04 UTC by Tomas Prochazka
Modified: 2009-03-23 12:49 UTC (History)
0 users

Original file from Office 97 (46.50 KB, application/vnd.ms-excel)
2009-03-12 00:04 UTC, Tomas Prochazka
XLS which has been open, edited and the saved in O2007 (50.00 KB, application/vnd.ms-excel)
2009-03-12 00:05 UTC, Tomas Prochazka

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Prochazka 2009-03-12 00:04:56 UTC
Created attachment 23373 [details]
Original file from Office 97

I have .XLS file which I can normally open by POI library. I opened it in Office
2007, replace one column with another data and dave it.

And now I get the this exception from POI:

Exception in thread "main" java.lang.RuntimeException: two Page Settings Blocks found in the same sheet
	at org.apache.poi.hssf.model.Sheet.<init>(Sheet.java:228)
	at org.apache.poi.hssf.model.Sheet.createSheet(Sheet.java:160)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:287)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:201)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:317)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:298)
	at cz.atomsoft.actum.carrefour.carrefourhelper.tasks.XlsToAccessConverter.convert(XlsToAccessConverter.java:81)
	at cz.atomsoft.actum.carrefour.carrefourhelper.tasks.XlsToAccessConverter.convert(XlsToAccessConverter.java:73)
	at cz.atomsoft.actum.carrefour.carrefourhelper.tasks.XlsToAccessConverter.searchFolderAndConverAllFiles(XlsToAccessConverter.java:68)
	at cz.atomsoft.actum.carrefour.carrefourhelper.tasks.XlsToAccessConverter.process(XlsToAccessConverter.java:54)
	at cz.atomsoft.actum.carrefour.carrefourhelper.App.main(App.java:31)

I tested it with two different documents. Interesting is, that when I create new document in Office 2007 and save it in compatibility mode, it works. Problem is only when I open old Office XLS and then save it.
Comment 1 Tomas Prochazka 2009-03-12 00:05:30 UTC
Created attachment 23374 [details]
XLS which has been open, edited and the saved in O2007
Comment 2 Josh Micich 2009-03-23 12:49:13 UTC
Fixed in svn r757520
junit added

Excel 2007 adds an extra page settings record, HEADERFOOTER(0x089C), which POI didn't process properly.