We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Insert Image into a Cell using Aspose.Cells


How can I Insert Image into a Cell using Aspose.Cells?

Thanks in advance


Hi Mamun,

Please check the document

Hi Mamun,

May the following code help you for your need. The picture will be inserted into a single cell i.e., G4.

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Insert picture into G4 cell.
int index = worksheet.Pictures.Add(3,6, 4, 7,"d:\\test\\school.jpg");
Thank you.

Thanks Amjad,

I am facing a problem in ImageURL. The Image that i want to show in the cell is in AppThemes of my solution. I am using the path "AppThemes/Granite/Images/logo.gif". but it cant find the path.

Is there is any special way to find the path of AppThemes of my .Net Solution?




Thanks for considering Aspose.

Well, you may try the following options for getting the path of your image file.

//Open template
string path = MapPath("~");
path = path.Substring(0, path.LastIndexOf("\\"));
path += @"\AppThemes\Granite\Images\logo.gif";

//Get the path of the Application folder.
string path = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Application.ExecutablePath), "..\\..");
//Get the image file path.
string imageFile = path + @"\AppThemes\Granite\Images\logo.gif";

Thank you.