You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by V S P <to...@fastmail.fm> on 2009/04/26 06:29:43 UTC

[Q] reading .xls with pulldown list

Hello
I am new to POI

and figuring out if I can use it to create .xls with pulldown menues.

I saw a similar question just posted recently but no answer an my
question ma be a bit different.


I assumed, may be incorrectly, that will not be able to create a
pulldown
menue, and instead I thought I would read a 'template' worksheet that
has a pulldown from my precreated excel file and then just copy it over
into memor, then add cells.

So I used Open Office to create the template .xls with 2 workbooks
the first one to contain the cells with pulldown
the second one to contain the values for pulldowns

clicked on a cell where I want the pulldown, added the control
 and specified data for the pulldown control to come from a second
 workbook
and saved it in OO as excel 97/2000

then I execute a sample program to just read the file
(found here http://sanjaal.com/java/?p=100 )

and I received an exception at

new HSSFWorkbook(myFileSystem);



org.apache.poi.hssf.record.RecordInputStream$LeftoverDataException:
Initialisation of record 0x205 left 1 bytes remaining still to be read.
	at org.apache.poi.hssf.record.RecordInputStream.hasNextRecord(RecordInputStream.java:124)
	at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:346)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:276)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:201)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:183)
	at com.setrak.present.excel.UiExcel.readExcelFile(UiExcel.java:51)
	at com.setrak.present.excel.UiExcel.main(UiExcel.java:31)


When I remove the cell with pulldown control the read works fine.


Therefore wanted to ask if what I am trying to do is 'supported' or if
not is there a workaround.

Thank you in advance,
VSP

-- 
  V S P
  toreason@fastmail.fm

-- 
http://www.fastmail.fm - Choose from over 50 domains or use your own


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


Re: [Q] reading .xls with pulldown list

Posted by V S P <to...@fastmail.fm>.
hi,

I have done some more tests
and searches

I now used the same .xls file as was used in this bug report
https://issues.apache.org/bugzilla/show_bug.cgi?id=27929

(I am using latest poi 3.5 beta 5 on w32 java 6 upd 13)

and POI worked fine with that file (proving that POI can at least
read pulldowns (I do not know yet how to 'create' them if at all
possible)

However as soon as I save that .xls file with Open Office (3.0.1)
I get an error (although not the same as I saw with my original test,
but perhaps relating to the same thing):

----------------
org.apache.poi.hssf.record.RecordFormatException: Unable to construct
record instance
	at org.apache.poi.hssf.record.RecordFactory.createSingleRecord(RecordFactory.java:226)
	at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:352)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:276)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:201)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:183)
	at com.setrak.present.excel.UiExcel.readExcelFile(UiExcel.java:52)
	at com.setrak.present.excel.UiExcel.main(UiExcel.java:32)
Caused by: java.lang.RuntimeException: Unexpected end-of-file
	at org.apache.poi.util.LittleEndianInputStream.checkEOF(LittleEndianInputStream.java:123)
	at org.apache.poi.util.LittleEndianInputStream.readUShort(LittleEndianInputStream.java:118)
	at org.apache.poi.hssf.record.SubRecord.createSubRecord(SubRecord.java:44)
	at org.apache.poi.hssf.record.ObjRecord.<init>(ObjRecord.java:92)
	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.createSingleRecord(RecordFactory.java:224)
	... 6 more


-----------------------


So if it is not possible to create a pulldown from POI, I will need to
get Excel and create workbooks with it (and then hopefully copy them
with POI into the final workbook)


VSP






On Sun, 26 Apr 2009 00:29 -0400, "V S P" <to...@fastmail.fm> wrote:
> Hello
> I am new to POI
> 
> and figuring out if I can use it to create .xls with pulldown menues.
> 
> I saw a similar question just posted recently but no answer an my
> question ma be a bit different.
> 
> 
> I assumed, may be incorrectly, that will not be able to create a
> pulldown
> menue, and instead I thought I would read a 'template' worksheet that
> has a pulldown from my precreated excel file and then just copy it over
> into memor, then add cells.
> 
> So I used Open Office to create the template .xls with 2 workbooks
> the first one to contain the cells with pulldown
> the second one to contain the values for pulldowns
> 
> clicked on a cell where I want the pulldown, added the control
>  and specified data for the pulldown control to come from a second
>  workbook
> and saved it in OO as excel 97/2000
> 
> then I execute a sample program to just read the file
> (found here http://sanjaal.com/java/?p=100 )
> 
> and I received an exception at
> 
> new HSSFWorkbook(myFileSystem);
> 
> 
> 
> org.apache.poi.hssf.record.RecordInputStream$LeftoverDataException:
> Initialisation of record 0x205 left 1 bytes remaining still to be read.
> 	at org.apache.poi.hssf.record.RecordInputStream.hasNextRecord(RecordInputStream.java:124)
> 	at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:346)
> 	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:276)
> 	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:201)
> 	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:183)
> 	at com.setrak.present.excel.UiExcel.readExcelFile(UiExcel.java:51)
> 	at com.setrak.present.excel.UiExcel.main(UiExcel.java:31)
> 
> 
> When I remove the cell with pulldown control the read works fine.
> 
> 
> Therefore wanted to ask if what I am trying to do is 'supported' or if
> not is there a workaround.
> 
> Thank you in advance,
> VSP
> 
> -- 
>   V S P
>   toreason@fastmail.fm
> 
> -- 
> http://www.fastmail.fm - Choose from over 50 domains or use your own
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 
-- 
  V S P
  toreason@fastmail.fm

-- 
http://www.fastmail.fm - Choose from over 50 domains or use your own


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


Re: [Q] reading .xls with pulldown list

Posted by MSB <ma...@tiscali.co.uk>.
Do you mean drop down lists? Drop down menus are obviously different beasts
entirely, more associated with naviagating around an application.

Anyway, cannot explain why you cannot read the file but have added to the
discussion in the other thread a couple of examples of how to create drop
down lists.


V S P wrote:
> 
> Hello
> I am new to POI
> 
> and figuring out if I can use it to create .xls with pulldown menues.
> 
> I saw a similar question just posted recently but no answer an my
> question ma be a bit different.
> 
> 
> I assumed, may be incorrectly, that will not be able to create a
> pulldown
> menue, and instead I thought I would read a 'template' worksheet that
> has a pulldown from my precreated excel file and then just copy it over
> into memor, then add cells.
> 
> So I used Open Office to create the template .xls with 2 workbooks
> the first one to contain the cells with pulldown
> the second one to contain the values for pulldowns
> 
> clicked on a cell where I want the pulldown, added the control
>  and specified data for the pulldown control to come from a second
>  workbook
> and saved it in OO as excel 97/2000
> 
> then I execute a sample program to just read the file
> (found here http://sanjaal.com/java/?p=100 )
> 
> and I received an exception at
> 
> new HSSFWorkbook(myFileSystem);
> 
> 
> 
> org.apache.poi.hssf.record.RecordInputStream$LeftoverDataException:
> Initialisation of record 0x205 left 1 bytes remaining still to be read.
> 	at
> org.apache.poi.hssf.record.RecordInputStream.hasNextRecord(RecordInputStream.java:124)
> 	at
> org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:346)
> 	at
> org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:276)
> 	at
> org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:201)
> 	at
> org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:183)
> 	at com.setrak.present.excel.UiExcel.readExcelFile(UiExcel.java:51)
> 	at com.setrak.present.excel.UiExcel.main(UiExcel.java:31)
> 
> 
> When I remove the cell with pulldown control the read works fine.
> 
> 
> Therefore wanted to ask if what I am trying to do is 'supported' or if
> not is there a workaround.
> 
> Thank you in advance,
> VSP
> 
> -- 
>   V S P
>   toreason@fastmail.fm
> 
> -- 
> http://www.fastmail.fm - Choose from over 50 domains or use your own
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-Q--reading-.xls-with-pulldown-list-tp23239168p23254141.html
Sent from the POI - User mailing list archive at Nabble.com.


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