poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MSB <markbrd...@tiscali.co.uk>
Subject Re: Copy images from Workbook to Workbook
Date Mon, 20 Apr 2009 06:43:29 GMT

To get at the actual position of the image on the page, you will need to
interrogate the client anchor object. It has methods called getRow1(),
getRow2(), getCol1() and getCol2(). They each return an int that together
will give you the indices of the cells at the top left hand and bottom right
hand corners of the cell. I am not sure but I guess that this will allow you
to easilly construct an anchor object for positioning the images on the copy

One other problem that remains to be resolved is tying together images and
positional details. The opt record contains details about the image itself
including it's location - it's fully qualified name. Getting at that
information is looking to be a little complex however - I am guessing that
you will have to look into the properties - the List of EscherProperty
objects - the opt record object maintains and try to interrogate it for the

The other problem is to prevent the code from returning multiple copies of
the information and I think that the key to this may be to use the recordID
value contained in both the opt and anchor records. Sadly, time is short for
me now - as it was a grand prix weekend, I booked time off even thugh this
is our busiest time of the year; not something I expect to do this week
sadly. Having said that, if I have the chance to work on the code, I will do

matthewxb wrote:
> I have a workbook contains two pictures. I want to copy the pictures from
> a source workbook to a target workbook. How can I do that?
> I used HSSFWorkbook.getAllPictures() to retrieve all the pictures, but it
> only allow me to read the pictures' binary data. I have to know the size
> and the location of each picture.
> I write a loop to read each worksheet and call
> HSSFSheet.getDrawingPatriarch(). It contains four methods in
> HSSFPatriarch, suppose they represent the location of picture.
> 	HSSFPatriarch.getX1(),HSSFPatriarch.getX2(), HSSFPatriarch.getY1(),
> HSSFPatriarch.getY2()
> But above methods return 0, which is incorrect.
> And the size of picture I couldn't find a way to know, since the actual
> picture size and the size shown in worksheet are different.
> I want to copy the pictures from a source workbook to a target workbook.
> How can I do that? Please advice, thank you very much!

View this message in context: http://www.nabble.com/Copy-images-from-Workbook-to-Workbook-tp23032425p23131185.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

View raw message