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

Adding image to Excel

Thread ID:

Created:

Updated:

Platform:

Replies:

131991 Aug 7,2017 03:07 PM UTC Aug 9,2017 06:06 AM UTC Xamarin.Forms 3
loading
Tags: XlsIO
Patrik K
Asked On August 7, 2017 03:07 PM UTC

Hi,

I'm trying to add an image to an Excel spreadsheet.
The problem is that the image is stretched through all the rows in the Spreadsheet.
Only the rows not the columns.

This is the code that I use and also some comments:

BitmapShapeImpl bitmap = workSheet.Pictures.AddPicture(1, 1, imageStream, 100, 100, ExcelImageFormat.Png) as BitmapShapeImpl;
bitmap.Width = bitmap.Picture.Width;      // the width is correct
bitmap.Height = bitmap.Picture.Height;    // the height is correct
int rowImage = bitmap.BottomRow;    // this is a really high number = 1048576
int columnImage = bitmap.RightColumn; // this is correct = 2


If I open the created Spreadsheet in Excel and check the properties for the image, I get the following:
- Height is 0
- Width is a correct Number
- Adapt Height (a percentage): This is a really high number 3 089 545%
- Adapt Width (a percentage): This is a correct number


This code used to work!
I have done some updates during the last month; for example to the XlsIO component (latest version) and to Xamarin Forms (latest stable version).
Today I noticed that this part of the code did no longer work...I have tried different solutions but nothing seems to help.



Attachment: ExcelExample_df3d9d00.zip

Mohan Chandran [Syncfusion]
Replied On August 8, 2017 01:43 PM UTC

Hi Patrik, 
 
Thank you for using Syncfusion products. 
  
We have tried the code snippet with the document attached and are unable to reproduce the issue at our end. The sample which we tried is shared for your reference and can be downloaded from the following link. 
  
  
Kindly modify the sample to reproduce the issue and share us to investigate further on this and provide a prompt solution at the earliest. 
 
Regards, 
Mohan Chandran. 


Patrik K
Replied On August 9, 2017 12:17 AM UTC

Hi Mohan,

when I checked my project today there were updates available for Syncfusion.Xamarin.XlsIO and Syncfusion.Xamarin.Compression.

I updated from 15.2.0.46 to 15.3.0.26 and after that everything worked again.

Thanks!


Mohan Chandran [Syncfusion]
Replied On August 9, 2017 06:06 AM UTC

Hi Patrik, 
 
We are glad that the issue is resolved at your end. Please let us know if you need any further assistance. 
 
Regards, 
Mohan Chandran. 


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.

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

;