word automation with asp.net (c#)

  • Thread starter Thread starter sgulciny
  • Start date Start date
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.............
 
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,
 
Back
Top