Creating Word Document in ASP.NET Application

Discussion in 'ASP .Net' started by =?Utf-8?B?Tm92aWNl?=, Aug 17, 2004.

  1. 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
     
    =?Utf-8?B?Tm92aWNl?=, Aug 17, 2004
    #1
    1. Advertising

  2. 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

    "Novice" wrote:

    > 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
     
    =?Utf-8?B?Tm92aWNl?=, Aug 17, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nikhil Patel

    creating word document in asp.net

    Nikhil Patel, May 12, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    1,013
    Nikhil Patel
    May 13, 2004
  2. Steve C. Orr [MVP, MCSD]

    Re: Creating Word document File in C# .Net

    Steve C. Orr [MVP, MCSD], Aug 29, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    2,789
    Steve C. Orr [MVP, MCSD]
    Aug 29, 2004
  3. Bruno MAIGNAN
    Replies:
    1
    Views:
    413
    Cubaman
    Jun 22, 2010
  4. Bruno MAIGNAN
    Replies:
    2
    Views:
    942
  5. Bruno MAIGNAN
    Replies:
    0
    Views:
    339
    Bruno MAIGNAN
    Jun 21, 2010
Loading...

Share This Page