You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by #CHEW BEE KIM# <CH...@ntu.edu.sg> on 2008/03/18 10:41:24 UTC

Question! HELP!

Hi,

Currently I have encountered a problem.

I want to retrieve data from a read-only Excel file, but an exception occurs.

My code is as followed:
try
{
InputStream KpExcel = new FileInputStream("kp.xls");

HSSFWorkbook Kpwb = new HSSFWorkbook(KpExcel);

HSSFSheet Kpsheet = Kpwb.getSheetAt(0);

......
}
catch(Exception e)
{
e.printStackTrace();
System.out.println("Exception: "+e.getMessage());
}

The error I received is as followed:

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:494)
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.<init>(HSSFWorkbook.java:163)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:210)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:191)
at photoproductionsystem.IncomingWIPPanel.getKp(IncomingWIPPanel.java:118)
at photoproductionsystem.IncomingWIPPanel.<init>(IncomingWIPPanel.java:76)
at photoproductionsystem.TabbedDisplay.<init>(TabbedDisplay.java:47)
at photoproductionsystem.Display.create(Display.java:73)
at photoproductionsystem.Display.init(Display.java:44)
at photoproductionsystem.Display.main(Display.java:229)
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)
... 15 more

Can someone please help me with my problem? Thanks a lot in advance! 
 
Regards,
Madeline

Re: Question! HELP!

Posted by Nick Burch <ni...@torchbox.com>.
On Tue, 18 Mar 2008, #CHEW BEE KIM# wrote:
> Currently I have encountered a problem.
>
> I want to retrieve data from a read-only Excel file, but an exception occurs.

First up, have you tried with the latest svn trunk? If you don't want to 
do your own build, you can download from:
 	http://encore.torchbox.com/poi-svn-build/

If that doesn't help, please open a new bug on bugzilla, and upload your 
problem file, along with information on how it was generated. It's also 
worth opening the file in excel or open office, and doing a "save as", to 
see if that fixes any broken records

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org