Creating Word Document in ASP.NET Application

G

Guest

Hi all, I'm using C# in my ASP.NET application and cannot seem to access the
MS word libraries to create a word document for some reason.

I have used both of these tutorials:
http://www.dotnetspider.com/Technology/KBPages/587.aspx
http://www.codeproject.com/aspnet/wordapplication.asp

But if I follow the instructions provided in the second tutorial I just end
up with the error:
C:\myDir\myWebPage.aspx.cs(69): The type or namespace name 'Word' could not
be found (are you missing a using directive or an assembly reference?)

However, after doing some more reading in various places on the web - I
found that some people need to "use" the library in their code - so I've
tried a variety of different "using" statements - for instance:
using Word = Microsoft.Office.Interop.Word;

However, when I do the above the code simply for a long time and eventually
returns:
exception: System.Runtime.InteropServices.COMException (0x80080005): Server
execution failed at ....

from the line:
Word.ApplicationClass objWord = new Word.ApplicationClass();

At that point I was using this COM library:
Microsoft Word 11.0 Object Library

However, after some further searching online I found other people suggesting
that instead of the above COM library I should use the following COM library:
Microsoft Office 11.0 Object Library

I have tried both independently (in my list of references) and with both
included.

I don't know what I should be doing differently - it would seem that some
people must have enjoyed success using this tutorial:
http://www.codeproject.com/aspnet/wordapplication.asp

So I have to assume I have some security setting or something that prevents
me from using office from within my asp.net application - perhaps something
in my web.config?

Can anyone make any suggestions?

Thanks,
Novice
 
G

Guest

The problem seems to have been caused by the user being impersonated not
having sufficient privileges to use Microsoft Word. After switching to the
Administrator account I was able to create the word document without a
problem.

Thanks,
Novice
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top