ASP.NET控制EXCEL,完全结束进程

发表于:2007-06-30来源:作者:点击数: 标签:
Excel.ApplicationThisApp=newExcel.ApplicationClass(); Excel.WorkbooksThisWbs=ThisApp.Workbooks; Excel.WorkbookThisWb=ThisWbs.Open("G:/demo.xls",Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Val
  
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.XlSaveAsAclearcase/" target="_blank" >ccessMode.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();

原文转自:http://www.ltesting.net