build word 2003 document from web application

G

Guest

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
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top