We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

IsLockAspectRatio- Placement- HeightScale not working correctly


we have different situations where HeightScale is never touched but while opening the xlsx with Excel we find it to a value different than 100%.

After this we tried to manage IsLockAspectRatio but it is never serialized.

And the property Placement sometimes doesnt behave as you would expect: we use usually freefloating and move, never moveandsize.

With freefloating sometimes we found that the generated files are having pics with absurd heighscale or widthscale.

With move sometimes the picture is moved also if the linked cell is not moved, or again strange heightscale and widthscale.

While debugging I never noticed strange things happening to the values applied. HeightScale and WidthScale are correctly 100 and islockaspectratio is having the correct value.

It is just when I open the file with Excel that the values are not correct.


Please download and try our latest version/fix: Aspose.Cells for .NET v7.3.2.2

If you still find the issue, give us a sample console application, zip it and post it here to reproduce the issue regarding the three attributes you pointed out on our end. Also attach your template Excel files here. We will check your issue soon.

thank you.

Ok, I tested this too.

From my tests, start from a xlsx where there is inside an image. Use the

InsertRange( CellArea area, int shiftNumber, ShiftType shiftType, bool updateReference );

function to insert a range:

- just under the image or intersecating the image (movedown): the image will move down, in Excel this does not happen.
- just right the image or intersecating the image (moveright): the image will move right, in excel this does not happen.
- just two cell above the image, always move down: the image will stay where it is, in Excel it shifts down
- just two cell left the image, always move right: the image will stay where it is, in Excel it shifts right

This is a problematic behaviour, also illogic. Moreover I noticed, but I couldn’t test it exactly: if there is a cell with data or style under the image, and the image is the bottom right corner, the last two behaviours are not happening,

After this, the other problem is the height problem that it is still present.

If I AddPicture in cell 0,0 the heightscale is correctly 100% when I open it in Excel and inside Aspose.Cells too.

If I AddPicture in cell 1,0 the heightscale is uncorrectly 101% when I open it in Excel and inside Aspose.Cells it is 100%

If I AddPicture in cell 2,0 the heightscale is uncorrectly 102% when I open it in Excel and inside Aspose.Cells it is 100%

etc etc

Until row 10 when it becames 111% instead of 110% inside Excel.

The problem is that if you begin to insertrange after adding a picture this rule screws up and I cant create a formula to correct it. The first formula to correct it that was working without insertrange was:
pict.HeightCM = pict.OriginalHeightCM * ( 100 - 100 / 87 * pict.upperLeftRow ) / 100;

This formula does not work if I insertrange left or over the image.

This height problem happens just with images added trough aspose.

Moreover when I set IsLockAspectRatio to false and I save the file and open it inside Excel, the flag is still true.

I always save as xlsx.



Well, I tried my sample code (given below) to simulate your some of your issues (you pointed out) but could not manage to reproduce the issue on my end. I did add an image to A2 cell in the first worksheet (in the workbook). Also, I insert a range using InsertRange() method while shifting down. I finally save the file to disk. When I opened the generated file into MS Excel and check the size properties for the picture, I can see height and width scale to i.e…, 100% (which are fine). Also the picture is not moved downwards at all. Here is my sample code and I have also attached my output file here.

Sample code:

Workbook wb = new Workbook();
Worksheet sheet1 = wb.Worksheets[0];
int index = sheet1.Pictures.Add(1, 0,“e:\test\school.jpg”);
CellArea cellarea = new CellArea();
cellarea.StartRow = 15;
cellarea.StartColumn = 0;
cellarea.EndRow = 20;
cellarea.EndColumn = 5;
sheet1.Cells.InsertRange(cellarea, 0, ShiftType.Down,true);

We appreciate if you could create a sample codes / console application to show your mentioned issues . You may zip the application and post it here with the template files (if you have any) here. You may also post separate posts/threads for each issue separately. It will help us to trace your pointed issues to log them into our database, so, we can figure them out soon.

Thank you.

hello right now i dont have time to produce it. when i will have more time i can try that way.

i forgot to mention that the movetype freefloating is never giving problem, just move anf moveandsize are.



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

It will be helpful if you could provide us your sample code/project reproducing this issue with the latest version:
for .NET v7.3.2.4

We will look into your issue and help you asap.