Created attachment 34565 [details] The file giving the error. The attached file opens in MS-Excel but does not open using Apache POI API. It gives a Duplicate PageSettingsBlock Record error. I investigated it and the record that is duplicate is : HorizontalPageBreakRecord I guess there was a similar error for multiple header/footer records (id = 42086 ) which was fixed.
I just tried it with the current turnk-version of POI and could not reproduce this, the document opens fine for me and I can read the data from it. Please try with a current nightly build () and if you still manage to reproduce this then please provide the full exception output and a self-sufficient piece of code that reproduces the problem.
A recent nightly build can be found at https://builds.apache.org/view/POI/job/POI-DSL-1.6/lastSuccessfulBuild/artifact/build/dist/
Please find the stack trace here: org.apache.poi.hssf.record.RecordFormatException: Duplicate PageSettingsBlock record (sid=0x1b) at org.apache.poi.hssf.record.aggregates.PageSettingsBlock.checkNotPresent(PageSettingsBlock.java:337) at org.apache.poi.hssf.record.aggregates.PageSettingsBlock.readARecord(PageSettingsBlock.java:256) at org.apache.poi.hssf.record.aggregates.PageSettingsBlock.addLateRecords(PageSettingsBlock.java:858) at com.quickoffice.ole.adapter.spreadsheet.elements.POISheet.<init>(POISheet.java:658)
What about the "self sufficient piece of code". i.e. what exactly do you do in POISheet.<init>(POISheet.java:658), please share the relevant parts of your code as it seems you are not just opening the spreadsheet, but rather do some more specialized processing here...
And please try with a more recent version of POI as it seems you still use a quite dated version where many fixes have been done over time.
Can you please tell if the current version of POI supports multiple HorizontalPageBreakRecord records, similar to multiple Header/Footer Records. If yes, can you please guide me to the cl/ which incorporated this change. Its not possible for me to migrate to the new version of POI. So can you please help me with this ?
This is happening while reading PageSettingsBlock Records from the file. Multiple HorizontalPageBreakRecord records are present leading to the exception.
We need sample code to reproduce it, I cannot say much based on the information provided...
Closing as WORKSFORME. Please reopen with supporting code if you are still facing this issue with the latest code (trunk).