You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "Karr, David" <da...@wamu.net> on 2007/03/28 00:22:35 UTC

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(NativeConstructorA
ccessorImpl.java:39)
	at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons
tructorAccessorImpl.java:27)
	at
java.lang.reflect.Constructor.newInstance(Constructor.java:274)
	at
org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java
:224)
	at
org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.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(RecordFactory.java
:237)
	at
org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.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: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: Protecting excel columns

Posted by Fulg de Nea <fu...@yahoo.com>.
I will try this way. Thanks for your answer.

Rodica

--- s k <si...@gmail.com> wrote:

> I use POI 2.5.1. It works fine.
> I did 3 things.
> 1. Create cell style and set lock, see:
> cellStyle.setLocked(boolean)
> 2. Set cell style to a cell e.g.
> cell.setCellStyle(cellStyle);
> 3. Protect your worksheet e.g.
> sheet1.setProtect(true);
> 
> S K
> 
> On 3/28/07, Fulg de Nea <fu...@yahoo.com> wrote:
> > Hi guys,
> >
> > I was wondering if it is possible to protect the
> excel
> > worksheets.. for example to set some cells not to
> be
> > editable. If this can be done, please tell me in
> which
> > POI version.
> >
> > Best regards,
> > Rodica


 
____________________________________________________________________________________
Get your own web address.  
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: Protecting excel columns

Posted by s k <si...@gmail.com>.
I use POI 2.5.1. It works fine.
I did 3 things.
1. Create cell style and set lock, see: cellStyle.setLocked(boolean)
2. Set cell style to a cell e.g. cell.setCellStyle(cellStyle);
3. Protect your worksheet e.g. sheet1.setProtect(true);

S K

On 3/28/07, Fulg de Nea <fu...@yahoo.com> wrote:
> Hi guys,
>
> I was wondering if it is possible to protect the excel
> worksheets.. for example to set some cells not to be
> editable. If this can be done, please tell me in which
> POI version.
>
> Best regards,
> Rodica
>
>
>
> ____________________________________________________________________________________
> Don't get soaked.  Take a quick peek at the forecast
> with the Yahoo! Search weather shortcut.
> http://tools.search.yahoo.com/shortcuts/#loc_weather
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Protecting excel columns

Posted by Fulg de Nea <fu...@yahoo.com>.
Hi guys, 

I was wondering if it is possible to protect the excel
worksheets.. for example to set some cells not to be
editable. If this can be done, please tell me in which
POI version.

Best regards,
Rodica


 
____________________________________________________________________________________
Don't get soaked.  Take a quick peek at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


RE: POI251: Worked fine reading one spreadsheet, new one throws RecordFormatException creating workbook

Posted by "Karr, David" <da...@wamu.net>.
Ok, well, that fixed it.  I guess I'll have to use the rc for now.

Thanks. 

> -----Original Message-----
> From: David Fisher [mailto:dfisher@jmlafferty.com] 
> Sent: Tuesday, March 27, 2007 4:10 PM
> To: POI Users List
> Subject: Re: POI251: Worked fine reading one spreadsheet, new 
> one throws RecordFormatException creating workbook
> 
> You might try the latest 3.0 RC1 at 
> http://people.apache.org/~nick/ POI-3.0-RC1/
> 
> I know that bugs related to macros were repaired in the last 
> couple of months.
> 
> Regards,
> Dave
> 
> On Mar 27, 2007, at 6:01 PM, Karr, David wrote:
> 
> > 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: poi-user-unsubscribe@jakarta.apache.org
> >> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> >> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
> >>
> >>
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> > The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: POI251: Worked fine reading one spreadsheet, new one throws RecordFormatException creating workbook

Posted by David Fisher <df...@jmlafferty.com>.
You might try the latest 3.0 RC1 at http://people.apache.org/~nick/ 
POI-3.0-RC1/

I know that bugs related to macros were repaired in the last couple  
of months.

Regards,
Dave

On Mar 27, 2007, at 6:01 PM, Karr, David wrote:

> 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: poi-user-unsubscribe@jakarta.apache.org
>> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
>> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


RE: POI251: Worked fine reading one spreadsheet, new one throws RecordFormatException creating workbook

Posted by "Karr, David" <da...@wamu.net>.
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: poi-user-unsubscribe@jakarta.apache.org
> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


RE: POI251: Worked fine reading one spreadsheet, new one throws RecordFormatException creating workbook

Posted by "Karr, David" <da...@wamu.net>.
If it matters, the only thing I know of that's different in this version
of the spreadsheet is that there are some cells with dropdown values.
The previous version did not do this.  I find it hard to believe this
could possibly cause the HSSFWorkbook load to fail, but that is the only
difference that I'm aware of (besides simple differences like column
names and content). 

> -----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: poi-user-unsubscribe@jakarta.apache.org
> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/