使用com组件进行Microsoft单词生成 [英] Using com component for Microsoft word generation
问题描述
嗨
我正在使用 Microsoft.Office.Interop.Word 将数据附加到word应用程序中.
Point是我成功地通过Visual Studio调试在开发模式下创建了我的所有需求,它可以正常工作,创建文件,追加数据并打开最终工作表.
但是当我在IIS上将其部署为虚拟目录时,在那里我将所有权限授予dcom组件中的ASPNET用户.
当我通过浏览器生成报告时,我能够看到WINWORD.exe将在进程队列中被调用,但是很快它将陷入死锁,什么也不会发生.
所以现在我想知道Com组件不能在Web应用程序中工作吗?
通过谷歌,我得到了一个知识库
http://support.microsoft.com/kb/257757/EN-US/ [ ^ ]
哪个说我必须使用openXML格式?这是什么意思...请帮助我吗?
我是否必须更改所有Microsoft Word文档的C#.net代码?
环境:Windows XP
具有框架3.5的Visual Studio 2010
Microsoft.Office.Interop.Word版本14.0.4733.1000
页面后面的C#.net代码
在此先感谢
问候
Mahendra Varandani
Hi
I am using Microsoft.Office.Interop.Word to append the data in word application.
Point is I am successful to create all my requirements in development mode via debugging through visual studio it work fine,create file,append data and open the final sheet.
But when I deployed the same on IIS as virtual directory.There I grant all the permission to ASPNET user in dcom components.
When I generate the report via browser then I am able to see the WINWORD.exe would be invoked in process queue but soon it will go in deadlock and nothing happens.
So right now I want to know will Com component not work in web application??
and via google I got a KB
http://support.microsoft.com/kb/257757/EN-US/[^]
which says that I have to use openXML format?? what it means...please assist me??
Do I have to change all my C#.net code for microsoft word doc??
Environment:Windows XP
Visual studio 2010 with framework 3.5
Microsoft.Office.Interop.Word version 14.0.4733.1000
C#.net code behind page
Thanks in advance
Regards
Mahendra Varandani
推荐答案
在web.config中编写以下代码
Hi,
Write below code in web.config
<identity impersonate="true" />
并将所有权限设置为网络用户和ASPNET用户,希望它将解决您的问题.我在使用excel应用程序时遇到了这个问题.它解决了我的问题.
and set all permissions to Network User and ASPNET User, Hopefully it will solve your problem. I have faced this problem when used excel application. it solved my problem.
按照知识库中的建议,不建议在Web服务器上使用自动化
除了许可方面的考虑外,您还可能会遇到权限问题和各种其他问题-在本文中突出显示了所有这些问题.
您可以使用打开XML SDK [下载在这里
[^ ]
否则,还有其他方法..... html + CSS文章在这里
使用HTML& CSS [ ^ ]
不过,一般来说,请远离Web服务器上的COM自动化-不推荐,不支持,只会给您带来麻烦
As advised in the KB, using Automation on web servers is not recommended
As well as licensing considerations, you are likely to run into permissions issues and various other problems - all highlighted in that article.
You can use the Open XML SDK[^] to create docx files
Download is here
[^]
Otherwise, there are other ways.....html + css article here
Dynamically generate a MS Word document using HTML & CSS[^]
In general though, stay away from COM automation on web servers - it''s not recommended, not supported and will cause you nothing but problems
这篇关于使用com组件进行Microsoft单词生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!