Click here to Skip to main content
15,912,493 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 31-Jan-12 2:01am
v2

Hi,

Write below code in web.config

HTML
<identity impersonate="true" />


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.
 
Share this answer
 
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
 
Share this answer
 
Comments
masdhasdh 31-Jan-12 9:49am    
@Sarvesh: I tried this but no luck still the same issue...

@Dylan:ohhh.. :( Thanks for advice but I tried to work around with open xml sdk as i have very big template file If i am converting that into xml then i am unable to process it as my end goal is to insert images,data table in the template so that become too much hectic or might i am in wrong direction.
Following the below URL:
http://msdn.microsoft.com/en-us/library/aa982683.aspx#Office2007ManipulatingXMLDocs_creating

Please assist me...
thanks again.!!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900