You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Shuichen Zhang <zh...@yahoo.com> on 2010/04/08 00:34:40 UTC

POI-3.5 Exception on Duplicate PageSettingsBlock record

Dear POI user list:

I cannot open attached Excl file using POI-3.5, I got an exception on "Duplicate PageSettingsBlock record", could anyone please help? Thank you in advance!

Best regards,
Shui-Chen

// **** test code ****** 
/* =======================================================================
   Problem      : POI-2.5 can open the Excel workbook, 
                  but both POI-3.5_FINAL & POI-3.6 failed.
   
   Exception in thread "main" 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 PoiTester.<init>(PoiTester.java:41)
	at PoiTester.main(PoiTester.java:52)

=================================================================*/

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;

public class PoiTester
{
	
   private PoiTester() throws IOException
   {
	   // Open
	   String filename = "C:\\poi\\wb.xls";
	   String fileout  = "C:\\poi\\wb_out.xls";
	   
	   Workbook wb = new HSSFWorkbook(new FileInputStream(filename));
	   
	   // Save & close
	   FileOutputStream out = new FileOutputStream(fileout);
	   wb.write(out);
	   out.close();
   }
   
   public static void main(String[] args)
   {
	   try {
		   new PoiTester();
	   } catch (IOException e) {
		   e.printStackTrace();
	   }
   }
}


      

Re: POI-3.5 Exception on Duplicate PageSettingsBlock record

Posted by Shuichen Zhang <zh...@yahoo.com>.
Dear Dave,

As you suggested, I tried the latest nightly build, it resolved the PageSettingsBlock problem.

Thank you so much for your help!

Best regards,
Shui-Chen

--- On Wed, 4/7/10, David Fisher <df...@jmlafferty.com> wrote:

> From: David Fisher <df...@jmlafferty.com>
> Subject: Re: POI-3.5 Exception on Duplicate PageSettingsBlock record
> To: "POI Users List" <us...@poi.apache.org>
> Date: Wednesday, April 7, 2010, 6:45 PM
> Several bugs with PageSettingsBlock
> were resolved between 3.5 and 3.6, but then, if I recall
> correctly, more were fixed since 3.6.
> 
> I would suggest that you download the trunk and build from
> source, or try a nightly build at http://encore.torchbox.com/poi-cvs-build/
> 
> Regards,
> Dave
> 
> On Apr 7, 2010, at 3:34 PM, Shuichen Zhang wrote:
> 
> > Dear POI user list:
> > 
> > I cannot open attached Excl file using POI-3.5, I got
> an exception on "Duplicate PageSettingsBlock record", could
> anyone please help? Thank you in advance!
> > 
> > Best regards,
> > Shui-Chen
> > 
> > // **** test code ****** 
> > /*
> =======================================================================
> >   Problem      : POI-2.5
> can open the Excel workbook, 
> >               
>   but both POI-3.5_FINAL & POI-3.6 failed.
> > 
> >   Exception in thread "main"
> 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
> PoiTester.<init>(PoiTester.java:41)
> >     at
> PoiTester.main(PoiTester.java:52)
> > 
> >
> =================================================================*/
> > 
> > import java.io.FileInputStream;
> > import java.io.FileOutputStream;
> > import java.io.IOException;
> > 
> > import org.apache.poi.hssf.usermodel.HSSFWorkbook;
> > import org.apache.poi.ss.usermodel.Workbook;
> > 
> > public class PoiTester
> > {
> >     
> >   private PoiTester() throws
> IOException
> >   {
> >        // Open
> >        String filename =
> "C:\\poi\\wb.xls";
> >        String
> fileout  = "C:\\poi\\wb_out.xls";
> >        
> >        Workbook wb = new
> HSSFWorkbook(new FileInputStream(filename));
> >        
> >        // Save &
> close
> >        FileOutputStream
> out = new FileOutputStream(fileout);
> >        wb.write(out);
> >        out.close();
> >   }
> > 
> >   public static void main(String[]
> args)
> >   {
> >        try {
> >        
>    new PoiTester();
> >        } catch
> (IOException e) {
> >        
>    e.printStackTrace();
> >        }
> >   }
> > }
> > 
> > 
> > <wb.xls>
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> > For additional commands, e-mail: user-help@poi.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 
> 


      

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: POI-3.5 Exception on Duplicate PageSettingsBlock record

Posted by David Fisher <df...@jmlafferty.com>.
Several bugs with PageSettingsBlock were resolved between 3.5 and 3.6, but then, if I recall correctly, more were fixed since 3.6.

I would suggest that you download the trunk and build from source, or try a nightly build at http://encore.torchbox.com/poi-cvs-build/

Regards,
Dave

On Apr 7, 2010, at 3:34 PM, Shuichen Zhang wrote:

> Dear POI user list:
> 
> I cannot open attached Excl file using POI-3.5, I got an exception on "Duplicate PageSettingsBlock record", could anyone please help? Thank you in advance!
> 
> Best regards,
> Shui-Chen
> 
> // **** test code ****** 
> /* =======================================================================
>   Problem      : POI-2.5 can open the Excel workbook, 
>                  but both POI-3.5_FINAL & POI-3.6 failed.
> 
>   Exception in thread "main" 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 PoiTester.<init>(PoiTester.java:41)
> 	at PoiTester.main(PoiTester.java:52)
> 
> =================================================================*/
> 
> import java.io.FileInputStream;
> import java.io.FileOutputStream;
> import java.io.IOException;
> 
> import org.apache.poi.hssf.usermodel.HSSFWorkbook;
> import org.apache.poi.ss.usermodel.Workbook;
> 
> public class PoiTester
> {
> 	
>   private PoiTester() throws IOException
>   {
> 	   // Open
> 	   String filename = "C:\\poi\\wb.xls";
> 	   String fileout  = "C:\\poi\\wb_out.xls";
> 	   
> 	   Workbook wb = new HSSFWorkbook(new FileInputStream(filename));
> 	   
> 	   // Save & close
> 	   FileOutputStream out = new FileOutputStream(fileout);
> 	   wb.write(out);
> 	   out.close();
>   }
> 
>   public static void main(String[] args)
>   {
> 	   try {
> 		   new PoiTester();
> 	   } catch (IOException e) {
> 		   e.printStackTrace();
> 	   }
>   }
> }
> 
> 
> <wb.xls>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org