We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Image size is not preserved when using AddPicture method

Thread ID:





106294 Dec 24,2012 08:12 PM UTC Sep 22,2014 08:54 AM UTC ASP.NET Web Forms (Classic) 3
Tags: XlsIO
Himanshu Kumar
Asked On December 24, 2012 08:12 PM UTC

My application generates a spreadsheet with the each product image and its details in a tablular format.
When I add an image to a worksheet using XlsIO [ sheet.Pictures.AddPicture(row, column, image, 80, 80) ] the image size is not preserved.
It appears shrinked when I open the generated excel file.
I have Syncfusion Version installed in my machine.
Sample Code:
sheet.SetRowHeightInPixels(row, 100);
image = new System.Drawing.Bitmap(OriginalImage, 100, 100);
IPictureShape picture = sheet.Pictures.AddPicture(row, column, image, 80, 80);
sheet.SetRowHeightInPixels(row, image.Height);
picture.Left = picture.Left + ((100- picture.Width) / 2);
picture.Top = picture.Top + ((100- picture.Height) / 2);
picture.IsSizeWithCell = true;
I would appreciate help and quick response.

Manikandan M [Syncfusion]
Replied On December 28, 2012 11:49 AM UTC

Hi Himanshu,

Thanks for using Syncfusion products.

We are not reproduce the issue "Image scaling(size) is set with specified value when adding the image" from our side. We have created the simplified sample and have attached the same below. Could you please update modify the below sample to reproduce the issue or update us the issue reproducing sample? So that we could analysis further and update you the solution.

Thank you very much for your patience.

Please let us know if you need any clarifications.



TSI Auto Solutions
Replied On September 18, 2014 12:49 PM UTC

Can you resend the sample please

We have the same issue here.

 Image img ;
 MemoryStream memoryStream = new MemoryStream(ReportSettings.PreferredLayoutEntityImage, 0, ReportSettings.PreferredLayoutEntityImage.Length);

  img = Image.FromStream(memoryStream, true);

IPictureShape imgTemp = Workbook.Worksheets[0].Pictures.AddPicture(Range.Row, Range.Column, newImage2);
imgTemp.Width = 5;
imgTemp.Height = 5;

Whatever value we putted on width and height.

The size never change.

Dilli Babu Nandha Gopal [Syncfusion]
Replied On September 22, 2014 08:54 AM UTC

Hi Jeff


Thank you for using Syncfusion products.


We have created a sample based on your requirement. The sample is available in below link.


Sample link: http://www.syncfusion.com/downloads/support/directtrac/129603/ChartAndPicture1462028974.zip


Please check the sample and let us know if you have any concerns.



Dilli babu.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon