Add image in Excel sheet using c#
Excel.Application app;
Excel.Workbook Excel_Book;
Excel.Worksheet Excel_sheet;
object mis_value = System.Reflection.Missing.Value;
app=new Excel.ApplicationClass();
Excel_Book = app.Workbooks.Add(mis_value);
Excel_sheet = (Excel.Worksheet)Excel_Book.Worksheets.get_Item(1);
Excel_sheet.Shapes.AddPicture(Server.MapPath("1.bmp"), Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoCTrue, 50, 50, 300, 500);
Excel_Book.SaveAs("test.xls", Excel.XlFileFormat.xlWorkbookNormal, mis_value, mis_value, mis_value, mis_value, Excel.XlSaveAsAccessMode.xlExclusive, mis_value, mis_value, mis_value, mis_value, mis_value);
Excel_Book.Close(true, mis_value , mis_value );
app.Quit();
Excel.Application app;
Excel.Workbook Excel_Book;
Excel.Worksheet Excel_sheet;
object mis_value = System.Reflection.Missing.Value;
app=new Excel.ApplicationClass();
Excel_Book = app.Workbooks.Add(mis_value);
Excel_sheet = (Excel.Worksheet)Excel_Book.Worksheets.get_Item(1);
Excel_sheet.Shapes.AddPicture(Server.MapPath("1.bmp"), Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoCTrue, 50, 50, 300, 500);
Excel_Book.SaveAs("test.xls", Excel.XlFileFormat.xlWorkbookNormal, mis_value, mis_value, mis_value, mis_value, Excel.XlSaveAsAccessMode.xlExclusive, mis_value, mis_value, mis_value, mis_value, mis_value);
Excel_Book.Close(true, mis_value , mis_value );
app.Quit();
No comments:
Post a Comment