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.
Unfortunately, activation email could not send to your email. Please try again.

Image size is not preserved when using AddPicture method

Thread ID:

Created:

Updated:

Platform:

Replies:

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

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.

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

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

TSI Auto Solutions
Replied On September 18, 2014 08:49 AM

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 04:54 AM

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.


CONFIRMATION

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.

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.

;