Hi,

I've searched through the archives and seen some queries similar to mine,
but no answers.

I need to embed images in Excel files that we're generating through POI. I'm
using the 3.0 alpha 3, and have been able to create files with images
embedded. What I need to know is how I can set the height and width of the
images to meaningful values. Ideally I'd like to set them to the images'
exact pixel dimensions, but I understand that Excel doesn't really do pixel
placement. Failing that, I'd like to be able to create an image that is
square (or has some other arbitrary height/width ratio).

At the moment I'm using:

HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 1023, 255, cellNum,
rowNum cellNum, rowNum);

This causes the image to be stretched over the entire cell. As I understand
it, the dy and dx values represent a proportion of the cell dimensions
(0-255 for y and 0-1023 for x). The problem is
that the cell width and height don't seem to be measured in the same units.

Is there another way to anchor the image to the sheet? Or, can I calculate
the values I need to put into dx and dy to get a particular aspect ratio?

Both MS Office and OpenOffice are able to set the image back to it's
original size once the file is loaded.. is it possible for POI to do that?

Thanks,
steve

Reply via email to