Image Scale Issue

Client is asking to put a logo in their report and they are requesting the image size be at 0.5" height and 0.68" width.


Using the following code:
Worksheet Worksheet = Workbook.Worksheets[WorksheetTitle]; picture = Worksheet.Pictures.Add(left, top, filepath, widthScale, heightScale); if (offset) { Aspose.Cells.Drawing.Picture opicture = Worksheet.Pictures[picture]; opicture.Left = offsetLeft; opicture.Top = offsetTop; opicture.IsLockAspectRatio = false; opicture.IsAutoSize= false; opicture.WidthInch = (double)0.68; opicture.HeightInch = (double)0.50; }

And what I get back almost works. The image in the Excel sheet gets the width of 0.68 but the height is 0.65 and the scale height is 42%/width 33% when I pass in 45% in widthScale and heightScale to the method.

Is there an automatic scaling occurring or do I need to set the image scaling in a particular order?

Hi Greg,


Thank you for contacting Aspose support.

We have evaluated your presented scenario while using the latest version of Aspose.Cells for .NET 8.2.2.3, and we believe the results are correct (please check the attached snapshot). If you are using any older version of the API we would request you to try this case with the latest assembly. In case the problem persists, please provide us the the following for detailed investigation.

  • Input sample spreadsheet.
  • Input image
  • Complete executable source code (preferably a sample application)