我已经看过很多关于这个问题的谷歌搜索回复的帖子,但是他们引用的解决方案都没有为我清楚.所以,我以为我会尝试自己.
在这段代码之后:
PowerPoint.Application powerPoint = new Microsoft.Office.Interop.PowerPoint.Application();
powerPoint.Visible = Office.MsoTriState.msoTrue;
Microsoft.Office.Interop.PowerPoint.Presentation ppt = null;enter code here
Run Code Online (Sandbox Code Playgroud)
我可以发出ppt.Quit(); 命令和Powerpoint将关闭,没有进程继续运行.
但是,如果在此代码之后我执行此操作:
ppt = powerPoint.Presentations.Open(localCopyOfPPT,
Microsoft.Office.Core.MsoTriState.msoCTrue,
Microsoft.Office.Core.MsoTriState.msoTriStateMixed,
Microsoft.Office.Core.MsoTriState.msoTrue);
ppt.Close();
powerPoint.Quit();
Run Code Online (Sandbox Code Playgroud)
然后,Quit()将无法正常工作.关于打开演示文稿的东西,即使我然后关闭它,也会阻止Quit()工作,它会出现.
任何人都有任何关于如何让应用程序退出正确的想法?
以下KB Aritcle可能会帮助您解决问题的根源. http://support.microsoft.com/kb/317109
您可能需要明确调用ppt实例上的System.Runtime.InteropServices.Marshal.ReleaseComObject.
| 归档时间: |
|
| 查看次数: |
9842 次 |
| 最近记录: |