Free Support Forum -

Sizing of pictures in cells

I'm having a problem with images added to the Pictures collection. Many of them are being resized by large ratios (and almost all of them are being resized at least a little).

I cannot find a way to explicitly set the dimensions of the pictures even though I have seen references to properties such as .HeightInch in other threads.

Any help?

This message was posted using Aspose.Live 2 Forum


Which version of Aspose.Cells for .NET you are using. Could you try the latest version (4.4.3): if it works fine.

I don't find any problem. following is my sample code:

Sample code:

Workbook workbook = new Workbook();
Worksheet objSheet = workbook.Worksheets[0];
objSheet.Pictures.Add(0, 1, @"d:\test\school.jpg");
Aspose.Cells.Picture objPicture = objSheet.Pictures[0];
objPicture.HeightInch = 2.65;
objPicture.WidthInch = 3.02;
objPicture.Placement = PlacementType.FreeFloating;
objPicture.IsLockAspectRatio = false;
objPicture.Top = 10;
objPicture.Left = 16;

And for your further reference, please check:

If you still find any issue, kindly post your sample code with template pictures here, we will check it soon.

Thank you.

Thanks. I was able to get what I needed using the 4.4.3 version of Cells that I downloaded from that link.

I'm currently using version 2.0 of Excel. Any suggestion on the best way to upgrade?


Thanks for considering Aspose.

Do you mean you were using Aspose.Excel previously and want to ugrade to newer Aspose.Cells, if so, well, Aspose.Excel has been renamed to become Aspose.Cells now. The latest Aspose.Cells component is more reliable, stable and prosperous with enhanced and advanced functionality. I think there is not much labor involved upgrading to the newer Aspose.Cells. However, when you upgrade to the newer Aspose.Cells,

Please note:

Some APIs (classes, struct, enumerations) are added based on some advanced features that we now offer, the previous classes (with their members) are retained and optimised but a few classes are renamed, some additional members (properties, methods etc.) are also included of the classes with a very few excluded.

Following is the classes list which are renamed:

1. Excel class is replaced by Workbook class.

2. ExcelDesigner class is replaced by WorkbookDesigner class.

3. ExcelHelper class is replaced by CellsHelper class.

For more info, please check the Aspose.Cells Documentation with APIs:

Thank you.

Thank you very much for all the help. Now here is one last question:

Can you verify for me whether or not the .HeightInch property (or any .Height style property) of the Picture object is accessible in Aspose.Excel version 2.0 or whether there is some way I can force images to render in their original dimensions?

Thanks again.