word automation with asp.net (c#)

S

sgulciny

Hi friends,I have a problem about word and asp.net .
When I run my project in visual web developer 2005 it works fine. But
in server it is not work. I think its about secury settings. What can
I do to call word document from server to client???

Here is my code
*************************************

object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.ApplicationClass oWordApp = new
Microsoft.Office.Interop.Word.ApplicationClass();
object oTemplate = @"C:\Inetpub\wwwroot\templates\request.dot";

Microsoft.Office.Interop.Word.Document oWordDoc =
oWordApp.Documents.Add(ref oTemplate, ref missing, ref missing, ref
isVisible);

oWordDoc.Activate();
object oBookMark = "FirmName";
oWordDoc.Bookmarks.get_Item(ref oBookMark).Range.Text = "bla
blaaa";
oWordApp.Visible = true;


and here is error in server
**********************************

System.NullReferenceException in oWordDoc.Activate();

Thanks for all.............
 
Joined
May 23, 2008
Messages
2
Reaction score
0
excell file similarity

Had the same issue with Excel. You need to set in your project REFERENCES for WORD dll the setting "copy local" to TRUE. Then - deploy it. Unless new errors will be discovered after.. :guru:
 
C

Cubaman

Hi friends,I have a problem about word and asp.net .
When I run my project in visual web developer 2005 it works fine. But
in server it is not work. I think its about secury settings. What can
I do to call word document from server to client???

Here is my code
*************************************

object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.ApplicationClass oWordApp = new
Microsoft.Office.Interop.Word.ApplicationClass();
object oTemplate = @"C:\Inetpub\wwwroot\templates\request.dot";

Microsoft.Office.Interop.Word.Document oWordDoc =
oWordApp.Documents.Add(ref oTemplate, ref missing, ref missing, ref
isVisible);

oWordDoc.Activate();
object oBookMark = "FirmName";
oWordDoc.Bookmarks.get_Item(ref oBookMark).Range.Text = "bla
blaaa";
oWordApp.Visible = true;

and here is error in server
**********************************

System.NullReferenceException in oWordDoc.Activate();

Thanks for all.............

Hello:
With the new officce version, a workaround would be to manipulate the
xml representation of the document as xml.
Just save the original doc as xml and the you can manipulate it with
xsl or loading a dom.
Best regards,
 

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,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top