using MSExcel = Microsoft.Office.Interop.Excel;
using System.IO;
using System.Reflection;
class Progarm
{
static void Main(string[] args)
{
string path;
MSExcel.Application excelApp;
MSExcel.Workbook excelDoc;
path = @"d:/test.xlsx";
excelApp = new MSExcel.ApplicationClass();
if(File.Exists(path))
{
File.Delete(path);
}
//由于使用COM库,许多变量需要用nothing代替
Object nothing = Missing.Value;
excelDoc = excelApp.Workbooks.Add(nothing);......
阅读全文