Here I am trying to show how we can export an image to excel file.
References Used: Microsoft.Office.Interop.Excel;
Link for downloading the dlls and install : Office XP PIAs
Add Microsoft.Office.Interop.Excel.dll, office.dll to the bin folder.
String sFileImage = System.IO.Path.Combine(System.Configuration.ConfigurationManager.AppSettings["UploadPath"], Session["UserId"].ToString() + ".gif");
String sFilePath = System.IO.Path.Combine(System.Configuration.ConfigurationManager.AppSettings["UploadPath"], Session["UserId"].ToString() + ".xls");
if (File.Exists(sFilePath))
{ File.Delete(sFilePath); }
Microsoft.Office.Interop.Excel.ApplicationClass objApp = new
Microsoft.Office.Interop.Excel.ApplicationClass();
Microsoft.Office.Interop.Excel.Worksheet objSheet = new
Microsoft.Office.Interop.Excel.Worksheet();
Microsoft.Office.Interop.Excel.Workbook objWorkBook = null;
//object missing = System.Reflection.Missing.Value;
try
{
objWorkBook = objApp.Workbooks.Add(Type.Missing);
objSheet = (Microsoft.Office.Interop.Excel.Worksheet)objWorkBook.ActiveSheet;
//Add picture to
single sheet1
objSheet = (Worksheet)objWorkBook.Sheets[1];

Suthish NairPosted Aug 30, 2010, 11:42 AM
The links provided are third party softwares. Above article using Microsoft.Office.Interop.Excel.dll only.