This is not such a simple process if I remember correctly. As it is such a
long time since I did anything like it, I cannot promise my memory is
accurate but I think it wen like this;

Get the drawing patriarch from the sheet - you do not say which stream you
are following XSSF or HSSF so I will assume HSSF here for reasons that will
become apparant a little later.
The HSSFPatriarch class defines a method - getChildren() - which retuns a
List of type HSSFShape.
HSSFPicture is a subtype of HSSFSimpleShape which is itself a subtype of
HSSFShape so you can iterate through the objects in the list and test each
ones type looking for instances of HSSFPicture - at least I think you can if
my memory is correct.
Once you get an HSSFPicture object, you can obtain the HSSFClientAnchor
object associated with each and interrogate it to discover where that
picture is on the sheet in terms of the positions of it's top right and
bottom left hand corners within specific cells. This will be expressed as a
row and column number and an offset. Be warned though that the offsets from
the edges of the cell are in character positions not somehting nice a usable
like milimeters.

Now, that ought to work with older binary workbooks processed using HSSF but
it will not work if you are working with OOXML based workbooks and XSSF. I
have never tried to do this sort of thing myself with this format and cannot
help until I have played around with some more code which I will be able to
if the rain continues and prevents us from emptying the charcoal kiln today.

Yours

Mark B


jerry-112 wrote:
> 
> Hey guys, 
> 
> I am a new comer to POI framework. In one of my project, I need to read
> images from a .xls file. For each row there is a column contains an image
> and I need to read it out. It looks like I can read all images together,
> but how can I get images position, like column number, row number so I can
> related those images with other data? Any suggestion is highly
> appreciated. Thanks. 
> 
> --Jiangpeng Shi
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@poi.apache.org
> For additional commands, e-mail: user-h...@poi.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/A-newbie-question%3A-how-to-get-image-position--tp28813811p28814293.html
Sent from the POI - User mailing list archive at Nabble.com.


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

Reply via email to