Some time ago, another post exactly like this one surfaced and we found that
the problem was with the anchor. It actually 'attaches' for want of a better
word, the bottom left hand corner of the image to the top left hand corner
of an adjacent cell. To explain this a little better, imagine that you
inserted an image into cell A1, then the bottom left hand corner of that
image would actually be 'attached' - again for waht of a better word - to
the top left hand corner of cell B2. This allows Excel to stretch the image
if the width of column A is increased or the heigth of row one is likewise
increased. It also seemed to be the reason why the image did not move when
the data was sorted - it was anchored to the top left hand corners of two
cells and Excel did not know how to handle this problem. The solution seemed
to be to change the way the images anchor was created so that you specified
the width and height of the image using Excels co-ordinate system; and I
cannot remember off hand exactly what these values were and so need to look
up some old code. When I get the full information, I will post again later.

The test I conducted to get to this answer was simple. I used POI to insert
images into cells just as you did and confirmed the 'sort proble'. Next, I
simply used Excel to modify the sizes of the images so that they no longer
overlapped the edges of the cell and found that the sort problem was
resolved. It might be worthwhile repeating this test yourself just to make
sure my recollection is correct.

Yours

Mark B

--
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/Anchor-image-to-a-cell-tp4302682p4305346.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to