You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Vijayakumar Gowdaman <vi...@db.com> on 2010/01/12 16:59:13 UTC

reading the drop down list cells

When reading the spreadsheet how to identify the cell containing a drop 
down list. After identifying  I need to retrieve all the values in the 
drop down list.

Also when writing in to the existing spreadsheet I want to update the 
selected value in the drop down list cell.

Can some one please point me in the right on how to do these tasks using 
POI.

Regards,

Vijayakumar Gowdaman


---

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.

Re: reading the drop down list cells

Posted by MSB <ma...@tiscali.co.uk>.
The more I look into this, the more I am convinced that you will need to
patch the API to get the functionality you require.

Sadly, snow and ice made it impossible for us to get into the woods today so
I have had some time to look into this question a little further. I think
that you need to gain access to the occurrence of the
org.apache.poi.hssf.model.InternalWorkbook class that encapsulates the low
level representation of the workbook. That class has a method called
getRecords() that returns a list of the record recovered from the file when
it was parsed. Now, org.apache.poi.hssf.record.Record is the parent of
another class called StandardRecord which is itself the parent of the
DVRecord and DVALRecord which contain the information you are after I
believe. What I think you will need to do is gain access to the
InternalWorbook, call the getRecords() method and sort through the List this
returns to identify the DVRecord and DVALRecord occurrences; I am going to
assume that instanceof will work for this.

Problem one is how to get at the InternalWorkbook and I cannot be of too
much help here as my own 'copy' of the development environment has developed
a fatal problem; I cannot get anything to compile for some reason. Anyway,
if you can get a copy of the source for the API and navigate to the
HSSFWorkbook class, I am sure that you could add an accessor method to
expose the InternalWorkbook to your client code. Of course, this will mean
maintaining your own copy of the API but I think it will work. It is the
route I am going to explore a little further if I can.

Yours

Mark B



VK123 wrote:
> 
> The reason I am doing this I am distributing the spreadsheet in to web 
> based format. So I am dynamically
> creating a html. For that I need to read each cell and if it is a drop 
> down list cell then I wanted to convert it
> in to html select box.
> Also the user updates the web page which on the back ground updates the 
> spreadsheet.
> 
> I'll go through the suggestions you have mentioned below and let you know.
> 
> Regards,
> 
> Vijayakumar Gowdaman
> 
> Group Technology & Operations (GTO)
> Global Markets
> Deutsche Bank
> off: 02075456250
> Mob:07789773998
> 
> 
> 
> MSB <ma...@tiscali.co.uk> 
> 12/01/2010 16:42
> Please respond to
> "POI Users List" <us...@poi.apache.org>
> 
> 
> To
> user@poi.apache.org
> cc
> 
> Subject
> Re: reading the drop down list cells
> 
> 
> 
> 
> 
> 
> 
> I have never needed to do anything like this and do not know the answer.
> Hoever, it looks as though you need to get at the DVRecord for the
> workbook/worksheet, I am not too sure which structure it is associated 
> with
> yet but I would guess the latter. The first way I have seen to gain access
> to this record is the createDVRecord() method of the HSSFDataValidation
> class but that method is not static and so you need an instance of the
> HSSFDataValidation class and I cannot see how to get at that currently. If
> you have a good search through the javadocs for methods that return a
> DVRecord, that should be a good place to start I think. Hopefully, one of
> the developers who knows the structure far better than I will respond 
> soon.
> 
> Will keep looking myself and if anything else presents itself, I will post
> again.
> 
> Yours
> 
> Mark B
> 
> 
> VK123 wrote:
>> 
>> When reading the spreadsheet how to identify the cell containing a drop 
>> down list. After identifying  I need to retrieve all the values in the 
>> drop down list.
>> 
>> Also when writing in to the existing spreadsheet I want to update the 
>> selected value in the drop down list cell.
>> 
>> Can some one please point me in the right on how to do these tasks using 
> 
>> POI.
>> 
>> Regards,
>> 
>> Vijayakumar Gowdaman
>> 
>> 
>> ---
>> 
>> This e-mail may contain confidential and/or privileged information. If 
> you
>> are not the intended recipient (or have received this e-mail in error)
>> please notify the sender immediately and delete this e-mail. Any
>> unauthorized copying, disclosure or distribution of the material in this
>> e-mail is strictly forbidden.
>> 
>> Please refer to http://www.db.com/en/content/eu_disclosures.htm for
>> additional EU corporate and regulatory disclosures.
>> 
> 
> -- 
> View this message in context: 
> http://old.nabble.com/reading-the-drop-down-list-cells-tp27129805p27130460.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
> 
> 
> 
> 
> 
> ---
> 
> This e-mail may contain confidential and/or privileged information. If you
> are not the intended recipient (or have received this e-mail in error)
> please notify the sender immediately and delete this e-mail. Any
> unauthorized copying, disclosure or distribution of the material in this
> e-mail is strictly forbidden.
> 
> Please refer to http://www.db.com/en/content/eu_disclosures.htm for
> additional EU corporate and regulatory disclosures.
> 

-- 
View this message in context: http://old.nabble.com/reading-the-drop-down-list-cells-tp27129805p27147173.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


Re: reading the drop down list cells

Posted by Vijayakumar Gowdaman <vi...@db.com>.
The reason I am doing this I am distributing the spreadsheet in to web 
based format. So I am dynamically
creating a html. For that I need to read each cell and if it is a drop 
down list cell then I wanted to convert it
in to html select box.
Also the user updates the web page which on the back ground updates the 
spreadsheet.

I'll go through the suggestions you have mentioned below and let you know.

Regards,

Vijayakumar Gowdaman

Group Technology & Operations (GTO)
Global Markets
Deutsche Bank
off: 02075456250
Mob:07789773998



MSB <ma...@tiscali.co.uk> 
12/01/2010 16:42
Please respond to
"POI Users List" <us...@poi.apache.org>


To
user@poi.apache.org
cc

Subject
Re: reading the drop down list cells







I have never needed to do anything like this and do not know the answer.
Hoever, it looks as though you need to get at the DVRecord for the
workbook/worksheet, I am not too sure which structure it is associated 
with
yet but I would guess the latter. The first way I have seen to gain access
to this record is the createDVRecord() method of the HSSFDataValidation
class but that method is not static and so you need an instance of the
HSSFDataValidation class and I cannot see how to get at that currently. If
you have a good search through the javadocs for methods that return a
DVRecord, that should be a good place to start I think. Hopefully, one of
the developers who knows the structure far better than I will respond 
soon.

Will keep looking myself and if anything else presents itself, I will post
again.

Yours

Mark B


VK123 wrote:
> 
> When reading the spreadsheet how to identify the cell containing a drop 
> down list. After identifying  I need to retrieve all the values in the 
> drop down list.
> 
> Also when writing in to the existing spreadsheet I want to update the 
> selected value in the drop down list cell.
> 
> Can some one please point me in the right on how to do these tasks using 

> POI.
> 
> Regards,
> 
> Vijayakumar Gowdaman
> 
> 
> ---
> 
> This e-mail may contain confidential and/or privileged information. If 
you
> are not the intended recipient (or have received this e-mail in error)
> please notify the sender immediately and delete this e-mail. Any
> unauthorized copying, disclosure or distribution of the material in this
> e-mail is strictly forbidden.
> 
> Please refer to http://www.db.com/en/content/eu_disclosures.htm for
> additional EU corporate and regulatory disclosures.
> 

-- 
View this message in context: 
http://old.nabble.com/reading-the-drop-down-list-cells-tp27129805p27130460.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





---

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.

Re: reading the drop down list cells

Posted by MSB <ma...@tiscali.co.uk>.
I have never needed to do anything like this and do not know the answer.
Hoever, it looks as though you need to get at the DVRecord for the
workbook/worksheet, I am not too sure which structure it is associated with
yet but I would guess the latter. The first way I have seen to gain access
to this record is the createDVRecord() method of the HSSFDataValidation
class but that method is not static and so you need an instance of the
HSSFDataValidation class and I cannot see how to get at that currently. If
you have a good search through the javadocs for methods that return a
DVRecord, that should be a good place to start I think. Hopefully, one of
the developers who knows the structure far better than I will respond soon.

Will keep looking myself and if anything else presents itself, I will post
again.

Yours

Mark B


VK123 wrote:
> 
> When reading the spreadsheet how to identify the cell containing a drop 
> down list. After identifying  I need to retrieve all the values in the 
> drop down list.
> 
> Also when writing in to the existing spreadsheet I want to update the 
> selected value in the drop down list cell.
> 
> Can some one please point me in the right on how to do these tasks using 
> POI.
> 
> Regards,
> 
> Vijayakumar Gowdaman
> 
> 
> ---
> 
> This e-mail may contain confidential and/or privileged information. If you
> are not the intended recipient (or have received this e-mail in error)
> please notify the sender immediately and delete this e-mail. Any
> unauthorized copying, disclosure or distribution of the material in this
> e-mail is strictly forbidden.
> 
> Please refer to http://www.db.com/en/content/eu_disclosures.htm for
> additional EU corporate and regulatory disclosures.
> 

-- 
View this message in context: http://old.nabble.com/reading-the-drop-down-list-cells-tp27129805p27130460.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