You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Jiybee <je...@gmail.com> on 2012/07/06 12:11:17 UTC

Copy data validation from a cell to another

Hi !

In my actual project, I need to copy row (same style, same comment and same
data validation) in a sheet. The problem is that I cannot find a way to copy
data validation. I've done some research and I know that a getdataValidation
exist in XSSF but I can't use XSSF, only HSSF because I need to work with
XLS (Excel 2003 is a client requirement).

Is there a way to know if a cell contain a data validation or a name in it? 
Is it possible to get it or to remove it?

Thanks for your help


--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Copy-data-validation-from-a-cell-to-another-tp5710380.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: Copy data validation from a cell to another

Posted by Mark Beardsley <ma...@tiscali.co.uk>.
No, there is no way to do this with HSSF I am afraid as the record that
contains the data validation data is not currently exposed.

One thing you may what to take a look at - and this does mean a lot of
digging - is whether the data is exposed as an Entry within the documents
structure. To test this out, you will need to create a POIFSFileSystem, call
the getRoot() method on it to get at the document's DirectoryNode and then
call the getEntries() method on this. This returns an Iterator that will
allow you to step through the entries to see what they are. Entries may have
children which you can then check out to see if any of them hold the data
you are after. If they do - and it is a very big if - you may be able to
extract the information you need to re-construct the data validation in the
new sheet I do not know if this will even work but am sure that HSSF does
read the data validation information from workbooks as it preserves it when
opening and then re-saving a workbook which contains validations.

If you do find the data validation data, why not consider patching the API
to expose it and then contributing the work back to the project? I am
confident others will find it useful.

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Copy-data-validation-from-a-cell-to-another-tp5710380p5710386.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