服务器的函数不会因为客户端IE关闭而中断执行的。 估计还是你程序的问题。 要catch异常,并且在Finially里面关闭word applicaton。
注意不止是关闭文档还要关闭applicaton
Word.Application = new Application ()
...
Other Code
....
doc.SaveAs2000 (...); // Now use the Quit method to cleanup
object saveChanges = true;
app.Quit(ref saveChanges, ref optional, ref optional);
注意不止是关闭文档还要关闭applicaton
Word.Application = new Application ()
...
Other Code
....
doc.SaveAs2000 (...); // Now use the Quit method to cleanup
object saveChanges = true;
app.Quit(ref saveChanges, ref optional, ref optional);
环境是VS2008,Word11
PowerPoint的代码你改一下 Microsoft.Office.Interop.Word.ApplicationClass wordApp = null;
try
{
//获取当前Word的实例
wordApp = System.Runtime.InteropServices.Marshal.GetActiveObject( "Word.Application" ) as Microsoft.Office.Interop.Word.ApplicationClass;
}
catch
{
} if ( wordApp != null )
{
//当前有打开的 Word ,关闭
object missing = System.Reflection.Missing.Value;
object savechanges = false; //不保存更改
wordApp.Quit( ref savechanges, ref missing, ref missing );
}
没有搞成功
你参考一下http://support.microsoft.com/kb/222783/zh-cn