我在页面上运行下面的代码出错:
Object Nothing=System.Reflection.Missing.Value; //取得Word文件保存路径
object filename="d:\\backup\\sn.doc"; //创建一个名为WordApp的组件对象
Word.Application WordApp=new Word.ApplicationClass();
Word.Document WordDoc=WordApp.Documents.Open(ref filename,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing);报错误是:接口 Word._Application 的 QueryInterface 失败。我在web.config中也加了<identity impersonate="true" />
Dcomcnfg也运行了,但还是不行
Object Nothing=System.Reflection.Missing.Value; //取得Word文件保存路径
object filename="d:\\backup\\sn.doc"; //创建一个名为WordApp的组件对象
Word.Application WordApp=new Word.ApplicationClass();
Word.Document WordDoc=WordApp.Documents.Open(ref filename,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing);报错误是:接口 Word._Application 的 QueryInterface 失败。我在web.config中也加了<identity impersonate="true" />
Dcomcnfg也运行了,但还是不行
解决方案 »
- 导出excel在2007中提示“文件类型与扩展名不同的对话框”
- 请问如何对ObjectDataSource的SelectMethod设定参数呢?
- 怎样判断无论网站从哪个页打开 都能检测是否COOKIES有效
- |M| 问一下大家在类里面
- 出一半分求条SQL查询语句
- 求助:js如何改变dropdownlist的选择项
- datagrid中如何用不同颜色表示不同类型的数据?
- 如何获得某个文件夹里的图片的个数?
- 孟子呀,我用你的可逆加密的方法怎么总报错呀。
- 《ASP.NET 2.0程序开发详解》源代码下载
- 大家幫幫忙﹐如何讓用戶不能下載﹐列印﹐另存,復制word文檔﹐只能的網上瀏覽。100分相送﹐急!!!
- 新手请教上传word文件在datagrid里添加此文件名的问题(100分立给)
运行
dcomcnfg
组件服务一项中选择Dcom配置,找到Microsoft word文档,察看属性
安全选项卡中,启动权限和访问权限,如果为了方便,可以添加Every one的用户
赋予权限,标识选项卡中选择交互式用户
另外 在Web.config中 添加模拟用户 <identity impersonate="true"/>
完毕后重新启动机器检查word是否安装正确
ps: 我已安装word
http://www.codeproject.com/aspnet/wordapplication.asp