You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "H@rry" <ap...@SoftHome.net> on 2003/04/30 08:06:18 UTC

Copying Cells

Hi all,

I need to copy a range of Cells from sheet1 to sheet2.
Is there a way to clone the cells from sheet1 to sheet2.

Now each each cell in sheet1, I create a cell in sheet2, set the Value,
Style, Type.
But this is not enough for me. Cos other properties like Validation
input(Validation List) and
comments of the cells are not copied over...

Anyone encounter similiar problem or have a way to work around this?


"I know that the world is always unfair.
 But I don't understand why it is never  unfair to my advantage."


@harry



RE: Copying Cells

Posted by "H@rry" <ap...@SoftHome.net>.
Hi Danny,

I have tried the clone method you mentioned.
But the method is protected so I dun have access to it.
And also, there is not way to set the cloned cell (if have) into a row.

I can only find  HSSFRow.createCell() and will need to do all the set???
but I will not be able to set the comment, validation list which are
currently
not supported thru the API signatures.

Is there anything I'm missing? Thanks!


"I know that the world is always unfair.
 But I don't understand why it is never  unfair to my advantage."


@harry


-----Original Message-----
From: Danny Mui [mailto:danny@muibros.com]
Sent: Wednesday, April 30, 2003 10:14 PM
To: POI Users List
Subject: Re: Copying Cells


for both of your questions, our usermodel objects (HSSFSheet and the
like) have clone methods.  I believe they make deep clones so styles and
cells get carried over.

H@rry wrote:

>Hi all,
>
>I need to copy a range of Cells from sheet1 to sheet2.
>Is there a way to clone the cells from sheet1 to sheet2.
>
>Now each each cell in sheet1, I create a cell in sheet2, set the Value,
>Style, Type.
>But this is not enough for me. Cos other properties like Validation
>input(Validation List) and
>comments of the cells are not copied over...
>
>Anyone encounter similiar problem or have a way to work around this?
>
>
>"I know that the world is always unfair.
> But I don't understand why it is never  unfair to my advantage."
>
>
>@harry
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: poi-user-help@jakarta.apache.org
>
>
>



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


Re: Copying Cells

Posted by Danny Mui <da...@muibros.com>.
for both of your questions, our usermodel objects (HSSFSheet and the 
like) have clone methods.  I believe they make deep clones so styles and 
cells get carried over. 

H@rry wrote:

>Hi all,
>
>I need to copy a range of Cells from sheet1 to sheet2.
>Is there a way to clone the cells from sheet1 to sheet2.
>
>Now each each cell in sheet1, I create a cell in sheet2, set the Value,
>Style, Type.
>But this is not enough for me. Cos other properties like Validation
>input(Validation List) and
>comments of the cells are not copied over...
>
>Anyone encounter similiar problem or have a way to work around this?
>
>
>"I know that the world is always unfair.
> But I don't understand why it is never  unfair to my advantage."
>
>
>@harry
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: poi-user-help@jakarta.apache.org
>
>  
>