Bug 60528 - Duplicate PageSettingsBlock Record
Summary: Duplicate PageSettingsBlock Record
Status: RESOLVED WORKSFORME
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-29 09:09 UTC by Priyanshu Srivastava
Modified: 2017-02-17 04:14 UTC (History)
1 user (show)



Attachments
The file giving the error. (236.08 KB, application/x-ole-storage)
2016-12-29 09:09 UTC, Priyanshu Srivastava
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Priyanshu Srivastava 2016-12-29 09:09:26 UTC
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.
Comment 1 Dominik Stadler 2017-01-02 19:26:37 UTC
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.
Comment 2 Dominik Stadler 2017-01-02 19:27:39 UTC
A recent nightly build can be found at https://builds.apache.org/view/POI/job/POI-DSL-1.6/lastSuccessfulBuild/artifact/build/dist/
Comment 3 Priyanshu Srivastava 2017-01-02 19:32:21 UTC
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)
Comment 4 Dominik Stadler 2017-01-02 20:48:45 UTC
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...
Comment 5 Dominik Stadler 2017-01-02 20:51:29 UTC
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.
Comment 6 Priyanshu Srivastava 2017-01-03 04:14:44 UTC
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 ?
Comment 7 Priyanshu Srivastava 2017-01-03 04:16:47 UTC
This is happening while reading PageSettingsBlock Records from the file. Multiple HorizontalPageBreakRecord records are present leading to the exception.
Comment 8 Dominik Stadler 2017-01-03 09:59:21 UTC
We need sample code to reproduce it, I cannot say much based on the information provided...
Comment 9 Javen O'Neal 2017-02-17 04:14:37 UTC
Closing as WORKSFORME. Please reopen with supporting code if you are still facing this issue with the latest code (trunk).