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

Free Support Forum - aspose.com

Large worksheet image size is getting changed


I am using Aspose Cells to add a large 7.5"W x 8.0"H (720x764) image into a worksheet using code like this:

int indexPicture = worksheet.Pictures.Add(row, col, stream);

Picture picture = worksheet.Pictures[indexPicture];

picture.Placement = PlacementType.Move; // no difference with FreeFloating

picture.UpperLeftColumn = col;

picture.UpperLeftRow = row;

After I open the xlsx file in Excel 2007, the image has been resized. The scale values show 100% and 104% for height and width, even though the "Lock aspect ratio" checkbox is checked.

Because of the increased size, the image does not fit on the printed page. This is a serious problem. Can you suggest how I can keep the image size from being adjusted from its original size?

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

Well, I tried your issue with the attached latest version of Aspose.Cells and it works fine. Please try the attached latest version of Aspose.Cells and if you still face any problem, please share your complete sample code and image file and we will check it soon.

Thank you & Best Regards,

Thanks for checking into this. I tried the latest version of Aspose Cells.NET and nothing has changed. Upon closer inspection, it may be behavior in Excel 2007 that is causing the problem. When I look at the Size and Properties dialog for the picture in normal view it shows the correct size without any scaling. However, when I switch to the View tab in the ribbon and select Page Layout, the image is now scaled 100% x 104%.

My basic intention is to get a picture to fill the entire width of the page (set at 7.5") without any scaling of the image, and so that it prints at the full size on a single printed page.

So maybe there is not a problem in Aspose.Cells as far as inserting pictures into an Excel document is concerned, but if you could provide me with some pointers on how I can insert and print the picture as intended, I would be greatly indebted. I have attached a sample picture and test app to help demonstrate the problem.



<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

After checking your issue further, I think it is the issue with MS Excel 2007. I inserted your image file in MS Excel manually and performed the steps you mentioned and the image size changes.

I think you may try PageSetup or Printing options to adjust the print area or paper size to fit the image into one page. Please see the following article for further details.


If you still need any further assistance, please do let us know. We will be happy to help you out.

Thank You & Best Regards,

Hi Nausherwan,

I think you are right about this being an Excel 2007 issue rather than a problem with Aspose.Cells. I can't find any way of manually fitting the picture correctly in Excel without resorting to scaling the image, so I don't see how I would be able to do it programmatically.

I think for now I will just stick to scaling the picture to 95%, although this slightly degrades the quality of the image.

Thanks for looking into this for me.