You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Narayanan <na...@tcs.com> on 2010/12/15 16:04:44 UTC

Copy xls sheet from one workbook to another work book using HSSF POI

Please help me in this requirement. I wanted to copy xls sheet (contains images,data and background colors) from one workbook to newly created workbook. I tried with HSSF POI. But not able to do it. Please provide me suggestion and sample code to do it. =====-----=====-----===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you 

-- 
View this message in context: http://apache-poi.1045710.n5.nabble.com/Copy-xls-sheet-from-one-workbook-to-another-work-book-using-HSSF-POI-tp3306417p3306417.html
Sent from the POI - User mailing list archive at Nabble.com.

Re: Copy xls sheet from one workbook to another work book using HSSF POI

Posted by Narayanan <na...@tcs.com>.
I am getting this error when try to copy image from one workbook sheet to
another workbook sheet

Instead of the proper image, its showing this error message in the copied
workbook sheet.

"The image cannot be displayed. Your computer may not have enough memory to
open the image, or the image may have been corrupted."

please give hint to resolve this issue.




-- 
View this message in context: http://apache-poi.1045710.n5.nabble.com/Copy-xls-sheet-from-one-workbook-to-another-work-book-using-HSSF-POI-tp3306417p3313643.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 xls sheet from one workbook to another work book using HSSF POI

Posted by Mark Beardsley <ma...@tiscali.co.uk>.
If you take a look back through the posts onto the list, you should see one
that discusses this code in quite some detail. I cannot remember exactly
when but think it might have been five to six months ago and you should see
my name in the posting history somewhere. If you find thatthread, there is
all of the code you will need to get at the anchors; do bear in mind though
that I have not yet been able to tie together images and anchors in a 'safe'
way.

Yours

Mark B
-- 
View this message in context: http://apache-poi.1045710.n5.nabble.com/Copy-xls-sheet-from-one-workbook-to-another-work-book-using-HSSF-POI-tp3306417p3310306.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 xls sheet from one workbook to another work book using HSSF POI

Posted by Narayanan <na...@tcs.com>.
Thanks All,

I am done with data copy from one workbook sheet to another by iterating
through cells.
I will try out image copy using anchor and Escher stream.
-- 
View this message in context: http://apache-poi.1045710.n5.nabble.com/Copy-xls-sheet-from-one-workbook-to-another-work-book-using-HSSF-POI-tp3306417p3309868.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 xls sheet from one workbook to another work book using HSSF POI

Posted by Mark Beardsley <ma...@tiscali.co.uk>.
Must admit that I agree with Aram. If you have to copy images from one
workbook to another, there are quite a few wrinkles and hurdles to tackle.
It is easy enough to get at the source data for the image but it's location
is held in something called an anchor record and these are only exposed as
part of the Escher stream. The records are part of a hierarchy that you will
have to iterate through in order to locate the information. As yet, I have
not found an easy, repliable way to tie tigether the image and it's
associated anchor so if you have a few images on the worksheet this could
pose quite a problem.

Yours

Mark B
-- 
View this message in context: http://apache-poi.1045710.n5.nabble.com/Copy-xls-sheet-from-one-workbook-to-another-work-book-using-HSSF-POI-tp3306417p3309586.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 xls sheet from one workbook to another work book using HSSF POI

Posted by Aram Mirzadeh <aw...@mbcli.com>.
Just in case it helps you in this case -- I was doing the same thing and 
having all sorts of issues until someone pointed out you can just copy 
the template using system copy and then modify what you want rather than 
do it programmatically.

On 12/15/2010 1:35 PM, Narayanan wrote:
> I can achieve this by iterating max rows and columns.Then create those many
> rows and cells to set cell value from first workbook. But for this i have to
> loop through and write lot of coding.
>
> I just wanted to know is there feature that POI provides to achieve this
> task.
>
>


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


Re: Copy xls sheet from one workbook to another work book using HSSF POI

Posted by Narayanan <na...@tcs.com>.
I can achieve this by iterating max rows and columns.Then create those many
rows and cells to set cell value from first workbook. But for this i have to
loop through and write lot of coding.

I just wanted to know is there feature that POI provides to achieve this
task.


-- 
View this message in context: http://apache-poi.1045710.n5.nabble.com/Copy-xls-sheet-from-one-workbook-to-another-work-book-using-HSSF-POI-tp3306417p3306754.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