DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42256>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42256

           Summary: unkown grbit '16'  error while reading excel file.
           Product: POI
           Version: 3.0-dev
          Platform: HP
        OS/Version: HP-UX
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: HSSF
        AssignedTo: poi-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


Hi, I am trying to read an excel file that was modified on excel 2003. Getting 
below exceptions:

java.lang.reflect.InvocationTargetException
        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:274)
        at org.apache.poi.hssf.record.RecordFactory.createRecord
(RecordFactory.java:213)
        at org.apache.poi.hssf.record.RecordFactory.createRecords
(RecordFactory.java:149)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:183)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:230)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:211)
        at ReadInvSheet.main(ReadInvSheet.java:47)
Caused by: org.apache.poi.hssf.record.RecordFormatException: Unknown grbit '16'
        at org.apache.poi.hssf.record.formula.ArrayPtg.readTokenValues
(ArrayPtg.java:98)
        at org.apache.poi.hssf.record.formula.Ptg.createParsedExpressionTokens
(Ptg.java:109)
        at org.apache.poi.hssf.record.NameRecord.fillFields(NameRecord.java:739)
        at org.apache.poi.hssf.record.Record.<init>(Record.java:55)
        at org.apache.poi.hssf.record.NameRecord.<init>(NameRecord.java:142)
        ... 10 more
Error in Reading : org.apache.poi.hssf.record.RecordFormatException: Unable to 
construct record instance, the following exception occured: null

Code snippet that is trying to read excel -
try
            {
              fs = new FileInputStream(fileToBeRead);
              System.out.println(" file read" );
              FI = new FileInputStream(propertyFile) ;
              FW = new FileWriter(fileToBeWritten);
            }
          catch(FileNotFoundException e)
            {
              throw new Exception(e);
            }
          catch(IOException e)
            {
              throw new Exception(e);
            }
          System.out.println("Before HSSFWorkbook Initiation");
          HSSFWorkbook workbook = new HSSFWorkbook(fs);
          System.out.println("After HSSFWorkbook Initiation");


Exception are right at initializing HSSFWorkbook() - HSSFWorkbook workbook = 
new HSSFWorkbook(fs);

We are using POI_3.0_Alpha.jar. I tried test with poi-3.0-rc3-20070402.jar and 
still have same error. 

I tried deleting all tabs in the excel file step by step and tried at last with 
no data also and I still have same error.
But when I try create empty excel on my machine(office 2000) and used it, 
program works fine.  

Could this be the issue with office 2003 compatibility? 

It is failing even with no data in the file that was created/updated on the 
machine which has office 2003.  Since no data and no array formulas in the 
excel file, control is still going to Ptg and ArrayPtg classes and calling 
readTokenValues(). 

I will attach the spread sheet that started causing issues. Thanks.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/

Reply via email to