using Microsoft.Office.Interop.Excel;//引用Microsoft.Office.Interop.Excel
//声明一个Excel Application
Microsoft.Office.Interop.Excel.Application appExcel = new Microsoft.Office.Interop.Excel.Application();
//声明一个Excel Workbook
Microsoft.Office.Interop.Excel.Workbook workbookData;
//声明一个Excel Work Sheet
Microsoft.Office.Interop.Excel.Worksheet worksheetData;
//打开路径为filepath的Excel
workbookData = appExcel.Workbooks.Open(filepath , System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing, System.Type.Missing);
try
{
//不显示弹窗、警告。在后台写入Excel