Bug 46840

Summary: Can't open Office 97 XLS which has been edited with Office 2007
Product: POI Reporter: Tomas Prochazka <t.prochazka>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 3.5-dev   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Attachments: Original file from Office 97
XLS which has been open, edited and the saved in O2007

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.