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: [email protected]
> For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to