build word 2003 document from web application

Discussion in 'ASP .Net' started by =?Utf-8?B?a3N0cml5aG9u?=, Aug 31, 2005.

  1. i need to create a new word 2003 document within a c# web application. this
    is the code i´m using

    private Microsoft.Office.Interop.Word.ApplicationClass WordApp = new
    Microsoft.Office.Interop.Word.ApplicationClass();

    object missing = System.Reflection.Missing.Value;

    object docType = 0;
    object isVisible = true;

    // Create a new Document, by calling the Add function in the Documents
    collection
    Microsoft.Office.Interop.Word.Document aDoc = WordApp.Documents.Add(ref
    missing, ref missing, ref docType, ref missing);

    WordApp.Visible = true;
    aDoc.Activate();

    but i´m getting an error in aDoc.Activate() line

    this is the error

    error:

    [NullReferenceException: Object reference not set to an instance of an
    object.]
    worddoc.StandardReport.Page_Load(Object sender, EventArgs e) in
    c:\mcms\worddoc\standardreport.aspx.cs:39
    System.Web.UI.Control.OnLoad(EventArgs e) +67
    System.Web.UI.Control.LoadRecursive() +35
    System.Web.UI.Page.ProcessRequestMain() +750

    any help would be appreciate or any suggestion about how to do this process

    thanks in advance
     
    =?Utf-8?B?a3N0cml5aG9u?=, Aug 31, 2005
    #1
    1. Advertising

  2. COM automation to Word is not recommended from ASP.NET.

    Instead you could use one of these techniques:
    http://SteveOrr.net/articles/ExportPanel.aspx
    http://SteveOrr.net/Articles/ExcelExport.aspx

    If you have more advanced needs, I'd recommend going with a 3rd party
    component, such as one of these:
    http://www.SteveOrr.net/Reviews/AsposeWord.aspx
    http://officewriter.softartisans.com/officewriter-189.aspx

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "kstriyhon" <> wrote in message
    news:...
    >i need to create a new word 2003 document within a c# web application. this
    > is the code i´m using
    >
    > private Microsoft.Office.Interop.Word.ApplicationClass WordApp = new
    > Microsoft.Office.Interop.Word.ApplicationClass();
    >
    > object missing = System.Reflection.Missing.Value;
    >
    > object docType = 0;
    > object isVisible = true;
    >
    > // Create a new Document, by calling the Add function in the Documents
    > collection
    > Microsoft.Office.Interop.Word.Document aDoc = WordApp.Documents.Add(ref
    > missing, ref missing, ref docType, ref missing);
    >
    > WordApp.Visible = true;
    > aDoc.Activate();
    >
    > but i´m getting an error in aDoc.Activate() line
    >
    > this is the error
    >
    > error:
    >
    > [NullReferenceException: Object reference not set to an instance of an
    > object.]
    > worddoc.StandardReport.Page_Load(Object sender, EventArgs e) in
    > c:\mcms\worddoc\standardreport.aspx.cs:39
    > System.Web.UI.Control.OnLoad(EventArgs e) +67
    > System.Web.UI.Control.LoadRecursive() +35
    > System.Web.UI.Page.ProcessRequestMain() +750
    >
    > any help would be appreciate or any suggestion about how to do this
    > process
    >
    > thanks in advance
    >
     
    Steve C. Orr [MVP, MCSD], Sep 1, 2005
    #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. =?Utf-8?B?a3N0cml5aG9u?=

    build word document from sql 2000 data base

    =?Utf-8?B?a3N0cml5aG9u?=, Aug 29, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    464
    =?Utf-8?B?a3N0cml5aG9u?=
    Aug 29, 2005
  2. srk
    Replies:
    0
    Views:
    680
  3. srk
    Replies:
    0
    Views:
    640
  4. Ravi
    Replies:
    1
    Views:
    1,896
    Mark Rae [MVP]
    Jan 14, 2008
  5. Michael G. Schneider

    Modifying a Word document without using Word Automation

    Michael G. Schneider, Dec 15, 2003, in forum: ASP General
    Replies:
    5
    Views:
    314
    el.c. - myLittleTools.net
    Dec 16, 2003
Loading...

Share This Page