I noticed from a FAQ entry that this could happen if the spreadsheet uses Excel features not supported by POI. Is there anything I can look at in Excel that will give me a clue on this?
> -----Original Message----- > From: Karr, David > Sent: Tuesday, March 27, 2007 3:23 PM > To: POI Users List > Subject: POI251: Worked fine reading one spreadsheet, new one > throws RecordFormatException creating workbook > > I have an app using POI 2.5.1 that reads a spreadsheet and > generates some other files from it (in text files). I had it > working with one version of the spreadsheet. I now have a > new version of the spreadsheet that is similar, but slightly > different. I need to update the app to use the new spreadsheet. > > I use the following code to initially load the spreadsheet: > > POIFSFileSystem fileSystem = > new POIFSFileSystem(new > FileInputStream(getExcelInputFile())); > HSSFWorkbook workbook = new > HSSFWorkbook(fileSystem); > HSSFSheet worksheet = > workbook.getSheet(getWorksheetName()); > > When I run my app with the new spreadsheet, the creation of > the HSSFWorkbook fails with the exception info that follows > this. Again, the previous version of the spreadsheet worked > fine here. What could be wrong here? > > java.lang.reflect.InvocationTargetException > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native > Method) > at > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeCo > nstructorA > ccessorImpl.java:39) > at > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Dele > gatingCons > tructorAccessorImpl.java:27) > at > java.lang.reflect.Constructor.newInstance(Constructor.java:274) > at > org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFa > ctory.java > :224) > at > org.apache.poi.hssf.record.RecordFactory.createRecords(RecordF > actory.jav > a:160) > at > org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook > .java:163) > at > org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook > .java:130) > at > com.wamu.uia.riskrating.genmessages.GenRiskRatingMessageFiles. > go(GenRisk > RatingMessageFiles.java:282) > at > com.wamu.uia.riskrating.genmessages.GenRiskRatingMessageFiles. > main(GenRi > skRatingMessageFiles.java:221) > Caused by: java.lang.ArrayIndexOutOfBoundsException > at java.lang.System.arraycopy(Native Method) > at > org.apache.poi.hssf.record.UnknownRecord.<init>(UnknownRecord.java:62) > at > org.apache.poi.hssf.record.SubRecord.createSubRecord(SubRecord > .java:57) > at > org.apache.poi.hssf.record.ObjRecord.fillFields(ObjRecord.java:99) > at org.apache.poi.hssf.record.Record.fillFields(Record.java:90) > at org.apache.poi.hssf.record.Record.<init>(Record.java:55) > at > org.apache.poi.hssf.record.ObjRecord.<init>(ObjRecord.java:61) > ... 10 more > org.apache.poi.hssf.record.RecordFormatException: Unable to > construct record instance, the following exception occured: null > at > org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFa > ctory.java > :237) > at > org.apache.poi.hssf.record.RecordFactory.createRecords(RecordF > actory.jav > a:160) > at > org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook > .java:163) > at > org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook > .java:130) > at > com.wamu.uia.riskrating.genmessages.GenRiskRatingMessageFiles. > go(GenRisk > RatingMessageFiles.java:282) > at > com.wamu.uia.riskrating.genmessages.GenRiskRatingMessageFiles. > main(GenRi > skRatingMessageFiles.java:221) > > --------------------------------------------------------------------- > 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/ > > --------------------------------------------------------------------- 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/
