【发布时间】:2009-04-24 18:10:18
【问题描述】:
我正在通过Microsoft.Office.Interop.Word 从模板 (.dot) 创建 Word 文档。下面的代码适用于某些模板,但不适用于其他模板:它不起作用的地方会引发RPC_E_SERVERFAULT 异常。这是怎么回事,可能是什么原因,我该如何解决? (第二行出现异常。)
wordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
wordDoc = wordApp.Documents.Add(ref oTemplate, ref newTemplate, ref docType, ref isVisible);
wordApp.Visible = false;
wordDoc.Activate();
【问题讨论】:
-
了解您是在交互式环境中还是在服务器上执行此操作会很有用。 Word 自动化的一个典型问题是应用程序由于弹出消息框而没有响应,或者 - 在服务器上 - 另一个进程已关闭 Word 实例。
标签: c# asp.net templates ms-word