473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

word automation with asp.net (c#)

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.............
Jun 27 '08 #1
2 1316
<sg******@yahoo.comwrote in message
news:16**********************************@i76g2000 hsf.googlegroups.com...
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 security settings.
Server-side Office automation is neither recommended nor supported by
Microsoft because it cannot be guaranteed to work properly (as you've
discovered) and, in some cases, can cause serious problems leading to data
loss:
http://support.microsoft.com/default...US;q257757#kb2
http://support.microsoft.com/default.aspx/kb/288367
What can I do to call word document from server to client???
http://www.aspose.com/categories/fil...a/default.aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #2
On May 23, 2:52 pm, sgulc...@yahoo.com wrote:
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,
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: mickeydisn | last post by:
Sub: C++ Word automation Extract text hello. I want extact text form a word document using a visual c++ programme. I have see a lot of documentation. and my analysis is that I must use a...
12
by: Cheval | last post by:
Has anyone had any problems with inter-office automation between MS Word and MS Access in Office 2003? I have recently installed office 2003 in a new folder and have left the older office 2000...
6
by: Colleyville Alan | last post by:
I have an application that has an Access table that stores the locations of slides in a Powerpoint file. This used to work fine when there were about 4 files and 200 slides. The database would...
2
by: kids | last post by:
Does anybody know any reason which could cause Ms. word automation to crash? I try to call word automation to open a document and use find and replace function. For some reason it works but I...
4
by: Daniel | last post by:
Hello, i have a problem with the word automation from c#. First, i want to mention, that i don't have any dependencies from word in my c#-project, i want to use the system.reflection model to...
0
by: mharris | last post by:
I need help with merging two Word documents into one through C# code. The problem isn't so much getting the documents put into one as it is maintaining the appropriate formatting, or rather...
2
by: Radek | last post by:
Hi, I have got such problem: in my directory "C:\folder" I have 3 files in MS WORD (having tables, images etc), these are: "1.doc", "2.doc", "3.doc". I want to write an application (C# of...
4
by: Yohancef Chin | last post by:
Hi, Being fairly new to .NET I am looking for a way to call MS Word from an event on a webform, and after the user is finished save that created document to an SQL Server database. Has anyone...
5
by: Daniel Walzenbach | last post by:
Hi, I need to know how I could populate a word file from within ASP.NET and stream it out to some user (I can rely on all users have at least Word XP installed). The preferable solution would be...
10
by: cj2 | last post by:
I open a word template in VB and add values to the bookmarks then save the document as as pdf. When I then go to close the document it pops up a save as dialog box. It's already saved the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.