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. Image for the cookie policy date
close icon

Image size is not preserved when using AddPicture method

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 9.2.0.137 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.

3 Replies

MM Manikandan M Syncfusion Team 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.

Thanks,
Manikandan.M


AddingImageinXlsIO_619f523c.zip


TA TSI Auto Solutions 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.







DB Dilli Babu Nandha Gopal Syncfusion Team 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.

 

Regards,

Dilli babu.


Loader.
Live Chat Icon For mobile
Up arrow icon