Free Support Forum -

Loading a Web Image from a URL into Excel Worksheet


I am loading an image from a URL into a cell of Excel Worksheet.The image gets loaded but it wraps itself into the size of the Excel cell.I want the Image Dimensions to be maintained even after it is loaded into the Excel cell.As this is a Dynamically generated report the Dimensions of the Images and hence the cells may be changing.So it there a way where the cell Dimensions can change as per the Image ?

Attaching a sample Excel sheet and also a .pdf to let you know the exact dimensions of the image when Exported to excel which is generated using another utility to let you know the exact dimensions of the image.

Please reply to me as soon as possible.



I think you may try to set row height and column’s width of the cell accordingly with your inserted picture,e.g you may get the insert picture and then specify the height and width of the row.column for the cell accordingly,e

//Set the height and width of the cell as per the inserted image.
workbook.Worksheets[0].Cells.SetColumnWidthInch(0, pic.WidthInch);
workbook.Worksheets[0].Cells.SetRowHeightInch(0, pic.HeightInch);

Thank you.