Issues when inserting a picture

Hi,

I’m using Aspose Cells for Java version 2.5.2 and I have some problems inserting a picture into a spreadsheet:

1) After inserting the picture’s size is somehow distorted. Width is normal but height is at 136%. But I need the picture to be in original size. When I set any row height on the picture’s row, the height is a sort-of-acceptable 105%.
Is there a way to get it to 100%? If possible without setting a fixed height on the row?

2) I would like the picture to be aligned with the right border of the cell, so it’s aligned with a table below. The best option I found was Picture.setLeft(-pictureWidth). This works, but Picture.setLeft() is deprecated. And the suggested replacement method Picture.setLeftPosition() ignores negative offsets.
Is there another way to do this? If possible not deprecated and without having to read the width of the picture first.

Thanks for your time,
Arend v. Reinersdorff

Hi,

Thanks for your posting and using Aspose.Cells for Java.

Please download and use the latest version:
Aspose.Cells
for Java v7.2.1.7

and upgrade your code, we provide the fixes based on latest versions only.

Whenever you insert picture, Ms-Excel changes its dimension, but you can enlarge or shrink the picture according to your choice.

Also you could try the following code

Java


pic.setWidth(pic.getOriginalWidth());

pic.setHeight(pic.getOriginalHeight());


For more help, please see the document.
Adding Pictures

thanks, I’ll try that :slight_smile:

Suppose we really have to upgrade our version of Aspose.Cells too…

Regards,
Arend v. Reinersdorff

Hi,

I will recommend you to upgrade to latest version because all the fixes are based on latest versions only.

However, the above code can be run on the older version too because I have checked that all the Picture.setHeight() and Picture.getOriginalHeight(), Picture.setWidth() and Picture.getOriginalWidth() APIs exist in older versions too.