asp.net 3.5 Office版本2007&中的MicrosoftOffice Automation. 2010年 [英] MicrosoftOffice Automation in asp.net 3.5 Office version 2007 & 2010

查看:106
本文介绍了asp.net 3.5 Office版本2007&中的MicrosoftOffice Automation. 2010年的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


背景:-我已经在自己的网站上开发了办公自动化.在这里我做了很多设置,例如IMPERSONATION,COM安全性,IIS,并且按要求工作.但所有这些都是为MICROSOFT OFFICE 2003完成的.没问题.

问题:-到目前为止,我需要在两台不同的服务器上使用MS Office 2010和2007设置我的应用程序.我从2007年开始,当我在开发机器上安装Office 2007和Interop for 2007时,它无法正常工作,因此我创建了一个虚拟应用程序,如果我不使用IIS,则可以正常工作,但是当我在IIS中配置此虚拟应用程序后,它停止上班.
关键问题是wordDocument为空.因此代码无法打开文档.可以模拟路径.
代码:-

Hi,
background:- I already developed office automation in my web site. where i done lot of settings like, IMPERSONATION, COM security, IIS and it is working as per required. but all these done for MICROSOFT OFFICE 2003. as far as good. no issue.

Problem:- by now i required to setup my application with MS Office 2010 and 2007 on two different servers. I started with 2007 and when i installed office 2007 and interop for 2007 on my development machine it is not working so i created a dummy application and it is working if i am not using IIS but when i configured this dummy application in IIS than it stops to work.
Key problem is wordDocument is null. so code is not able to open the document. Path impersonation is Okay.
Code:-

object file = @"c:\test\01\test.doc";
ApplicationClass wordApp = new ApplicationClass();
object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
Document wordDocument = wordApp.Documents.Open(ref file, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing);



我无法理解为什么它为null.



I am not able to understand why it is null.

推荐答案

我不知道确切的原因,但是我在Office 2010中也遇到了同样的问题. br/> 解决方法是在创建应用程序和打开文档之间延迟一些时间.
希望对您有所帮助.
I don''t know the exact reason, but I have faced the same issue with Office 2010.
The work around is to put some delay between application creation and document open.
I hope this helps.


这篇关于asp.net 3.5 Office版本2007&中的MicrosoftOffice Automation. 2010年的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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