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

Examples of inserting images into an Excel sheet

Can anyone provide some samples of inserting images into row/cell when the image is coming from some external web location?
Thanks!

6 Replies

DB Dilli Babu Nandha Gopal Syncfusion Team June 16, 2016 06:16 AM UTC

Hi Todd, 

Thank you for contacting Syncfusion support. 

Yes, you can able to insert an image from a Web location in a worksheet using XlsIO. The following code example illustrates this behavior. 

Code Example: 
 
IWorksheet worksheet = workbook.Worksheets[0]; 
 
string imgLoc= @"https://cdn.syncfusion.com/content/images/company-logos/Syncfusion_Logo_Image.png"; 
 
//Retrieving from Web 
WebClient webClient = new WebClient(); 
byte[] imageBytes = webClient.DownloadData(imgLoc); 
MemoryStream stream = new MemoryStream(imageBytes); 
 
//Adding a picture 
IPictureShape shape = worksheet.Pictures.AddPicture(1, 1,stream); 
 

We have shared a sample for your reference which can be downloaded from the following link. 


Please let us know whether the sample fulfills your requirement. 

Regards, 
Dilli babu. 



SA sandra January 9, 2020 10:18 AM UTC

Images can’t be inserted into cells, but actually they are present in separate layer and keep floating over the cells. Well you can resize image to get into a specific cell by stretching or squeezing the corners of your image but this results in an untidy looking spreadsheet. 


As the image won’t appears to set in a specific cell. I have done this task of inserting gif image into Excel using VBA code and got perfect result. 


If you also want to try then take help from this post: How To Insert Animated GIF Images In Excel 2007/2010/2013/2016



FV Fatima Vieira replied to Dilli Babu Nandha Gopal August 31, 2021 03:34 PM UTC

Any way I can inject multiple images, please note these are embedded and not web images into a sheet in specific locations, I am looking for something like this more or less?


Would it be a good direction to use a grid and export to excel in the grid?