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.

How to insert picture in Excel file

Thread ID:

Created:

Updated:

Platform:

Replies:

125665 Sep 1,2016 02:31 AM Oct 3,2016 08:45 AM UWP 5
loading
Tags: XlsIO
Sharad Kumar
Asked On September 1, 2016 02:31 AM

Hi,

My excel file is not open in case while insert picture in excel file.
"AddPicture" method allow to add image . but my sheet is not view .

my code is
ExcelEngine oengine = new ExcelEngine();
IApplication oApp = oengine.Excel;
oApp.DefaultVersion = ExcelVersion.Excel2007;
IWorkbook oWorkbook  =  oApp.Workbooks.Create(1);
IWorksheets osheets = oWorkbook.Worksheets;
IWorksheet  osheet = osheets .Worksheets[0];

 StorageFolder tmpFolder = await ApplicationData.Current.LocalFolder.GetFolderAsync("TmpFolder");
 StorageFile Imagefile1 = await tmpFolder.GetFileAsync(ImgName);
 Stream imageStream1 = await Imagefile1.OpenStreamForReadAsync();            

 osheet .Pictures.AddPicture(1, 5, 4, 9, imageStream1);   

Excel file is attach with mail which is not open .
Thanks

Attachment: Repaired_pngmultiimagetest_e37ace53.rar

Abirami Varadharajan [Syncfusion]
Replied On September 2, 2016 05:31 AM

Hi Sharad, 
 
Thank you for contacting syncfusion support. 
 

We are able to reproduce issue with “File gets corrupted in Excel 2007 while adding picture”. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates. 

  

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents  

  

Please let us know if you have any questions. 

 
Regards, 
Abirami. 


Sharad Kumar
Replied On September 28, 2016 06:09 AM

Hi,

if window application is running in release mode. Maximum time picture are not recover in recover excel file.
kindly provide best solution.

I am using same code for given previous question.

Thanks
sharad kumar

Abirami Varadharajan [Syncfusion]
Replied On September 29, 2016 08:40 AM

Hi Sharad,
 
We are unable to reproduce the issue. However, the issue with “File gets corrupted in Excel 2007 while adding picture” was fixed and included in our 14.1 version.
 
We also recommend you to upgrade to the latest version (14.3), which has more enhancements and fixes. The latest version of Syncfusion Essential Studio can be downloaded from the following link.  
  
  
If you still have issue in 14.3v, then kindly share us the image which you are trying to insert. This will be helpful for us to provide prompt solution at the earliest.
  
Regards, 
Abirami. 


Sharad Kumar
Replied On September 30, 2016 06:11 AM

hi,

I am working on latest version 14.3.
Code snippet is given below . this code is working 1 out of 30 .
for(int i = 0;i<4;i++)
{
                StorageFolder tmpFolder = await ApplicationData.Current.LocalFolder.GetFolderAsync("TmpFolder");
                StorageFile Imagefile1 = await tmpFolder.GetFileAsync(ImgName);
                Stream imageStream1 = await Imagefile1.OpenStreamForReadAsync();   
                try
                {
                        if(i==0)
                             osheet .Pictures.AddPicture(1, 1, imageStream1);   
                       else if(i==1)
                             osheet .Pictures.AddPicture(5, 8, imageStream1);  
                       else if(i==2)
                             osheet .Pictures.AddPicture(7, 9, imageStream1);  
                }
                catch (Exception e)
                {
                 }
}
Maximum time osheet(Worksheet class object) object through exception "Message = "Index was outside the bounds of the array."
Files are attach which through exception.

Thanks
Sharad kumar


Attachment: 0011162_9a05bc2c.rar

Abirami Varadharajan [Syncfusion]
Replied On October 3, 2016 08:45 AM

Hi Sharad, 
 
Thank you for updating us. 
 

We are able to reproduce the issue with “Exception thrown while adding picture in UWP”. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates.  

   

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents   

   

Regards, 
Abirami. 


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.

;