Add a reference to the "Microsoft Excel 11.0 Object Library" should make the "Microsoft.Office.Interop.Excel" Namespaces available. And should clear the WorkSheet, ad set content in the specify cell, something like this
Code Block
void button2_Click(object sender, EventArgs e)
object oMissing = Missing.Value;
Application ExcelObj =
new Microsoft.Office.Interop.Excel.Application();
Workbook WBook;
Worksheet WSheet;
@"c:\test\a.xlsx",
Worksheet)WBook.Sheets.get_Item(1);
"aaaa";
true;
Marshal.ReleaseComObject(WSheet);
Marshal.ReleaseComObject(WBook);
Marshal.ReleaseComObject(ExcelObj);
null;
null;
null;
GC.Collect();
Add a reference to the "Microsoft Excel 11.0 Object Library" should make the "Microsoft.Office.Interop.Excel" Namespaces available. And should clear the WorkSheet, ad set content in the specify cell, something like this
Code Block
void button2_Click(object sender, EventArgs e)
object oMissing = Missing.Value;
Application ExcelObj =
new Microsoft.Office.Interop.Excel.Application();
Workbook WBook;
Worksheet WSheet;
@"c:\test\a.xlsx",
Worksheet)WBook.Sheets.get_Item(1);
"aaaa";
true;
Marshal.ReleaseComObject(WSheet);
Marshal.ReleaseComObject(WBook);
Marshal.ReleaseComObject(ExcelObj);
null;
null;
null;
GC.Collect();
You can use google to search for other answers
|