Interop.Word Documents.Open卡 [英] Interop.Word Documents.Open stuck

查看:140
本文介绍了Interop.Word Documents.Open卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个不同的机器上相同的应用程序。在第一台机器都做工精细,而在第二台机器我有一个问题。

I have same application on two different machine. On first machine all work fine, while in second machine I have a problem.

调试code,我可以看到,当Interop.Word Documents.Open被称为然后执行保持锁定状态,决不进入下一个code线,同时浏览器(IE7)停留在加载。

Debugging code I can see that when Interop.Word Documents.Open is called then execution remains locked, and never go to next code line, while browser (IE7) stuck on loading.

我需要打开一个Word模板,打开的文档中编写,然后将其关闭。
因此,我以下内容:

I need to open a word template, write in opened document, and then close it. So I do following :

_Application wdApp = new Application();
wdApp.Documents.Open(templatePath);

为什么第一台机器这个工程上?有参考的问题?我想补充相同的dll互操作在我的机器...

Why on first machine this works? There are reference problems ? I add same Interop dll in my machine...

在DCOM配置设置我有两个机器为Microsoft Word 97-2003文档上相同的配置:

In DCOM Config Settings I have same configuration on the two machine for Microsoft Word 97-2003 Documents:

身份 - >启动用户

保护 - > ASPNET用户和管理员的所有权限

protection -> ASPNET user and ADMINISTRATOR with all permission


  • 1 - 编辑:页面被锁定,在调试时,我去:

  • 1 - edit : the page is locked, in debugging when I go to :

wdApp.Documents.Open(的templatePath);

wdApp.Documents.Open(templatePath);

什么appens,控制永远不会在下次code线,以及浏览器加载永远

nothing appens, control never goes on next code line , and browser forever loading

推荐答案

有时word.interop会导致它pviously打开被损坏(例如,如果它没有保存并关闭正确)$ P $ word文档。这是不容易被发现和字作为你所描述的互操作的行为。
我以前也遇到同样的问题。
尝试删除您尝试打开该模板文件。用新文件替换它。看看这有助于在所有。

Sometimes the word.interop can cause the word document it has previously opened to become corrupt (if for example it did not save and close properly). This is not easily detected and word interop will behave as you have described. I have faced the same problem before. Try to delete the template file you are trying to open. Replace it with a new file. see if this helps at all.

这篇关于Interop.Word Documents.Open卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆