Excel.Application ThisApp = new Excel.ApplicationClass();
Excel.Workbooks ThisWbs = ThisApp.Workbooks;
Excel.Workbook ThisWb = ThisWbs.Open("G:/demo.xls",Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value);
ThisWb.SaveAs("G:/HelloExcel.xml",Excel.XlFileFormat.xlXMLSpreadsheet,Missing.Value,Missing.Value,Missing.Value,Missing.Value,Excel.XlSaveAsAccessMode.xlNoChange,Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value);
//Excel.XlFileFormat.xlXMLSpreadsheet控制存储文件的类型
System.Runtime.InteropServices.Marshal.ReleaseComObject(ThisWb);
ThisWb = null;
ThisWbs.Close();
System.Runtime.InteropServices.Marshal.ReleaseComObject(ThisWbs);
ThisWbs = null;
System.Runtime.InteropServices.Marshal.ReleaseComObject(ThisApp);
ThisApp = null;
GC.Collect();