Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 1st, 2005, 08:57 PM
Registered User
 
Join Date: Jun 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help!! Problem instantiating WORD object using C#.

Hi experts,

I am trying to open the content of a WORD file from C#.NET which resides in the REMOTE SERVER, however, when declaring new Word.ApplicationClass(), I get an error:

"System.Runtime.InteropServices.COMException: Server execution failed"

When I see the event viewer in the web server, the error is:
"The server did not register with DCOM within the required timeout. "


string fileName = this.btnWorkOrder1.Value;
object readOnly = false;
object isVisible = false;
object saveChanges = false;
object missing = System.Reflection.Missing.Value;
object dynamic = 2;

//error here:
Word.ApplicationClass oWordApp = new Word.ApplicationClass();

Word.Document oWordDoc = oWordApp.Documents.Open(ref file, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref isVisible);


Does anybody know how to solve it? Please help I'm desperate!!!

Thanks alot!!!


Handy Mulia
 
Old June 2nd, 2005, 12:15 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

Please do not post the same topic at more than one place

http://p2p.wrox.com/topic.asp?TOPIC_ID=31205

Regards
Ganesh
 
Old June 2nd, 2005, 12:54 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

I use the following code
Code:
Word.ApplicationClass MyWord = new Word.ApplicationClass();
object fileName = @"E:\Ganesh\MyDesktop\CSharp.doc";
object readOnly = false;

object isVisible = true;

object missing = System.Reflection.Missing.Value;
MyWord.Visible = true;

Word.Document aDoc = MyWord.Documents.Open(ref fileName, ref missing,ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible);
aDoc.Activate();

MyWord.Selection.TypeText("Test Text");
MyWord.Selection.TypeParagraph();
Hope it helps

Regards
Ganesh
 
Old November 16th, 2006, 05:18 PM
Registered User
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

But I am still Facing the problem
i.e. No Overload for method 'Open' takes '12' Aguments

My Code


            object filename="c:\nik.doc";
            object readOnly = false;
            object isVisible= true;
            object missing=System.Reflection.Missing.Value;
            Word.ApplicationClass oWordApp = new Word.ApplicationClass();
            Word.Document oWordDoc= oWordApp.Documents.Open(ref filename, ref missing,ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible);

        oWordDoc.Activate();
            oWordApp.Selection.TypeText("Hello Nikhil");
            oWordApp.Selection.TypeText("Welcome To Word Automation");
            oWordDoc.Save();
            oWordApp.Application.Quit(ref missing,ref missing,ref missing);






Similar Threads
Thread Thread Starter Forum Replies Last Post
Help!! Problem instantiating WORD object using C#. handymulia ASP.NET 1.0 and 1.1 Professional 1 June 2nd, 2005 12:55 AM
WORD COM object in ASP mcinar Classic ASP Basics 0 April 14th, 2005 10:34 AM
Accessing WORD object in ASP mcinar Classic ASP Basics 5 March 30th, 2005 04:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.