日期:2014-05-17 浏览次数:20892 次
转载自http://topic.csdn.net/u/20081117/11/2cf68184-87b8-4e12-b3b9-b8c2ecf635d8.html
?
powerpoint也一样,"System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);"释放所有引用,最后System.GC.Collect();
object objmissing = System.Reflection.Missing.Value; Excel.ApplicationClass application = new ApplicationClass(); Excel.Workbook book = application.Workbooks.Add(objmissing); Excel.Worksheet sheet = (Excel.Worksheet)book.Worksheets.Add(objmissing,objmissing,objmissing,objmissing); //操作过程 ^&%&×&……&%&&…… //释放 sheet.SaveAs(path,objmissing,objmissing,objmissing,objmissing,objmissing,objmissing,objmissing,objmissing); System.Runtime.InteropServices.Marshal.ReleaseComObject((object)sheet); System.Runtime.InteropServices.Marshal.ReleaseComObject((object)book); application.Quit(); System.Runtime.InteropServices.Marshal.ReleaseComObject((object)application); System.GC.Collect();