Hello:

This is really strange.  I have two empty spreadsheets.  POI can read one
but not the other.

When I try to read the sheet.xls file, I get this exception:

Exception in thread "main" org.apache.poi.hssf.record.RecordFormatException:
Unable to construct record instance
        at
org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:199
)
        at
org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:11
7)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:207)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:259)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:240)
        at POITest.main(POITest.java:9)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at
org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:187
)
        ... 5 more
Caused by: java.lang.IllegalArgumentException: Illegal length
        at
org.apache.poi.hssf.record.RecordInputStream.readCompressedUnicode(RecordInp
utStream.java:270)
        at
org.apache.poi.hssf.record.FileSharingRecord.fillFields(FileSharingRecord.ja
va:62)
        at org.apache.poi.hssf.record.Record.<init>(Record.java:55)
        at
org.apache.poi.hssf.record.FileSharingRecord.<init>(FileSharingRecord.java:4
8)
        ... 10 more

Here is my code:

import java.io.*;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

public class POITest {
  public static void main(String[] args) throws Exception{
    System.out.println("Reading sheet 2:");
    new HSSFWorkbook(new FileInputStream("C:\\Tmp\\sheet2.xls"));
    System.out.println("Reading sheet 1:");
    new HSSFWorkbook(new FileInputStream("C:\\Tmp\\sheet.xls"));
  }
}

I have attached the spreadsheets.  

Any ideas what is happening?

Thanks,
        Neil

--
Neil Aggarwal, (832)245-7314, www.JAMMConsulting.com
Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details.

Attachment: sheet.xls
Description: MS-Excel spreadsheet

Attachment: sheet2.xls
Description: MS-Excel spreadsheet

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to