开发者

Java POI exception

开发者 https://www.devze.com 2023-01-25 00:22 出处:网络
These are the steps that i do: Save excel file. Run program that reads the excel file. When i do those steps i get this error immediately:

These are the steps that i do:

Save excel file. Run program that reads the excel file.

When i do those steps i get this error immediately:

java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) a开发者_如何学Ct sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:224) at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:160) at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:163) at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:130) at

Caused by: java.lang.ArrayIndexOutOfBoundsException: 11 at org.apache.poi.util.LittleEndian.getNumber(LittleEndian.java:491) at org.apache.poi.util.LittleEndian.getInt(LittleEndian.java:139) at org.apache.poi.hssf.record.BOFRecord.fillFields(BOFRecord.java:133) at org.apache.poi.hssf.record.Record.fillFields(Record.java:90) at org.apache.poi.hssf.record.Record.(Record.java:55) at org.apache.poi.hssf.record.BOFRecord.(BOFRecord.java:98) ... 12 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(RecordFactory.java:237) at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:160) at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:163) at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:130) at

When i do these steps i dont get the error:

Save excel file.

Open excel file.

Click on a cell.

Hit save.

Run program.

No error is thrown.

Does anyone know why this would be? It is very frustrating!!!!!


1 of the scenario in poi 2.5.1 is,

If you select a data validation cell right before saving the excel document, you get the similar stack trace. The workaround would be to select simple text cell then proceed to save the document.

bug report filed, https://issues.apache.org/bugzilla/show_bug.cgi?id=50761


This can be because of various reasons.

One I just found:

U will get this error, if excel has any filter enabled

0

精彩评论

暂无评论...
验证码 换一张
取 消