Bug 48852

Summary: Getting Duplicate PageSettingsBlock record (sid=0x89c) with POI 3.6
Product: POI Reporter: Brett Zane <bzane>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED DUPLICATE    
Severity: critical    
Priority: P4    
Version: 3.6-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   

Description Brett Zane 2010-03-04 02:27:04 UTC
I'm getting this exception trying to open a .xls excel file.  If I save the file as a new file, the new file opens properly.  This file opens fine with POI 3.0.

I would attach the file but I'm not sure if the content can be shared.  If you really need it then I can find out.

org.apache.poi.hssf.record.RecordFormatException: Duplicate PageSettingsBlock record (sid=0x89c)
	at org.apache.poi.hssf.record.aggregates.PageSettingsBlock.checkNotPresent(PageSettingsBlock.java:227)
	at org.apache.poi.hssf.record.aggregates.PageSettingsBlock.readARecord(PageSettingsBlock.java:215)
	at org.apache.poi.hssf.record.aggregates.PageSettingsBlock.addLateRecords(PageSettingsBlock.java:639)
	at org.apache.poi.hssf.model.Sheet.<init>(Sheet.java:222)
	at org.apache.poi.hssf.model.Sheet.createSheet(Sheet.java:158)
	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 org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:60)
Comment 1 Jens Teglhus Møller 2010-03-05 15:37:29 UTC
I am seeing this as well, but is currently not able to produce a file that generates the error (the file that causes this is company confidential :-().
Comment 2 Alex Bouhier 2010-03-09 08:40:15 UTC
Here : http://www.dirinformatique.com/TELEBUDGET/ you can download ("Télécharger") some XLS files that don't work with POI 3.6.

I have the same error with these files:

org.apache.poi.hssf.record.RecordFormatException: Duplicate PageSettingsBlock record (sid=0x89c) VM: 1.6.0_17@http://java.sun.com/ at org.apache.poi.hssf.record.aggregates.PageSettingsBlock.checkNotPresent(PageSettingsBlock.java:227) at org.apache.poi.hssf.record.aggregates.PageSettingsBlock.readARecord(PageSettingsBlock.java:215) at org.apache.poi.hssf.record.aggregates.PageSettingsBlock.addLateRecords(PageSettingsBlock.java:639) at org.apache.poi.hssf.model.Sheet.(Sheet.java:222) at org.apache.poi.hssf.model.Sheet.createSheet(Sheet.java:158) at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:287) at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:201) at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:183) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
Comment 3 Yegor Kozlov 2010-03-15 06:32:17 UTC
The problem was fixed in r892468 in Dec 2009. It was after POI-3.6, so you need to download the latest nightly build to try the fix. 

All "Télécharger" files are opened OK with POI trunk.

Nightly builds can be downloaded from http://encore.torchbox.com/poi-cvs-build/

Yegor

*** This bug has been marked as a duplicate of bug 48026 ***
Comment 4 Vasili 2010-04-16 10:29:44 UTC
I'm trying to use the most recent snapshots, as you suggested (with 3.6 I'm getting the exception even after re-saving the file).
Having downloaded and after putting into the classpath:
 
poi-3.7-SNAPSHOT-20100415.jar
poi-ooxml-3.7-SNAPSHOT-20100415.jar
poi-contrib-3.7-SNAPSHOT-20100416.jar

I was getting exceptions (ClassNotFound) and also had to put into the classpath:

poi-ooxml-schemas-3.7-SNAPSHOT-20100415.jar
xmlbeans-2.3.0.jar
dom4j-1.6.1.jar

Now I'm getting Exception with any file, I'm trying to open (even simple Excel 97): 

org.apache.poi.POIXMLException: org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package should contain a content type part [M1.13]
	at org.apache.poi.util.PackageHelper.open(PackageHelper.java:41)
	at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:176)
	at org.is.jxlpoi.JXLPOIWorkbook.getWorkbook(JXLPOIWorkbook.java:29)

Do you have a suggestion?
(for a particular snapshot, later than r892468, to use)

thanks
vasili
Comment 5 Vasili 2010-04-16 11:08:38 UTC
sorry, here is the end of StackTrace:


Caused by: org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package should contain a content type part [M1.13]
	at org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:147)
	at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:588)
	at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:222)
	at org.apache.poi.util.PackageHelper.open(PackageHelper.java:39)
	... 21 more
Comment 6 Vasili 2010-04-16 13:40:53 UTC
Also tried less recent snapshots - getting the same problem/exception...
Please, help!
Comment 7 Vasili 2010-04-19 10:58:45 UTC
Please, disregard my message.
I've started to use WorkbookFactory and now it is fine.
(I'm using the most recent snapshot).