object Nothing = System.Reflection.Missing.Value;
var app = new Excel.Application();
app.Visible = false;
Excel.Workbook mybook = app.Workbooks.Open(filenameExcel, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing);
var app = new Excel.Application();
app.Visible = false;
Excel.Workbook mybook = app.Workbooks.Open(filenameExcel, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing);
Excel.Worksheet mysheet = (Excel.Worksheet)mybook.Worksheets[1];
mysheet.Activate();
mysheet.Cells[row, 1].NumberFormatLocal = "@"; //日期格式设置为 文本 类型,否则写入excel后,小数位的秒会被截断
mysheet.Cells[row, 1] = time;//time= 2015-08-07 10:24:49.079
//所有信息写入excel完成后
mybook.Save();
mybook.Close(false, Type.Missing, Type.Missing);
mybook = null;
//quit excel app
app.Quit();