first of all, it is really a bad practice to use Office application on the server side, you should consider to redesign your app to avoid using office apps alltogetherINFO: Considerations for Server-Side Automation of Office http://support.microsoft.com/kb/257757but seeOffice application does not quit after automation from Visual Studio .NET client http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q317109
在生成新的excel进程时,首先检测系统中已经运行中的excel进程,记录下它们的Ids
在new个新的进程时,再次检测系统中已经运行中的excel进程,根据Ids可以判断出new的新excel进程的Id(这当然是有漏洞的,但一般情况下可以满足需要的)
在Kill此进程
如果此时我已经起了excel 文档, 我怎么区别哪个进程就是我自己在程序中new 出来的?
http://support.microsoft.com/kb/257757but seeOffice application does not quit after automation from Visual Studio .NET client
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q317109
然后设excelclass = null;然后调用System.GC.Collect();
好像就可以了,excel就没有了,反正记得GC一下
to ==〉saucer(思归) :Yours advise is redesign ? My project is going to end . In any case , thank you.