473,837 Members | 1,494 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting proble to Open word document on server

2 New Member
Hi ,
I have write the following code to open word document on server

Expand|Select|Wrap|Line Numbers
  1. using Microsoft.Office.Interop.Word;
  3.  string DocPath = System.Configuration.ConfigurationManager.AppSettings["VirtualDocPath"];
  5.             ApplicationClass wordApp = new ApplicationClass();
  6.             string filePath = "";
  7.             filePath = DocPath + Session["username"] + "/" + DocFile.Value.ToString();
  8.             lblPath.Text = Server.MapPath("~/Document/" + Session["username"]) + "/" + DocFile.Value.ToString();
  9.             object file = filePath;
  10.             object readOnly = false;
  11.             object isVisible = true;
  12.             object nullobj = System.Reflection.Missing.Value;
  13.             wordApp.Visible = false;
  15.             // here on Document.Open there should be 9 arg.
  16.             //Word.Document doc = new Document();
  17.             //Microsoft.Office.Interop.Word.Document doc;
  19.             Microsoft.Office.Interop.Word.Document doc = wordApp.Documents.Open(ref file,
  20.             ref nullobj, ref readOnly, ref nullobj, ref nullobj, ref nullobj,
  21.             ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj,
  22.             ref isVisible, ref nullobj, ref nullobj, ref nullobj, ref nullobj);
  25.             // Here the word content is copeied into a string which helps to
  26.             // store it into textbox.
  27.             Microsoft.Office.Interop.Word.Document doc1 = wordApp.ActiveDocument;
  29.             string m_Content = doc1.Content.Text;
  31.             // the content is stored into the textbox.
  32.             if (sMode.Trim() == "ReadOnly")
  33.             {
  34.                 txtdocument.ReadOnly = true;
  35.                 btnSave.Visible = false;
  36.                 btnEsign.Visible = false;
  37.             }
  39.             txtdocument.Text = m_Content;
  40.             doc.Close(ref nullobj, ref nullobj, ref nullobj);

This code is working fine on my local machine ond other local machine where Microsoft office 2007 is installed
but on my server I'm getting the following

Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005

Can anyone give me solution of this error.

Thanks in advance

Sep 4 '09 #1
2 4439
9,735 Recognized Expert Moderator Expert
Is Microsoft office 2007 installed on the server?
Sep 4 '09 #2
2 New Member
i got the solution finally.
I have just given the full rights to the aspnet user on server to that particular folder where I have to keep my documents.
Apr 6 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Josh Asbury | last post by:
Hi all - I am having troubles with implementing a CommandBar in Microsoft Word utilizing VB.net. My CommandBar appears when I start Word, but if I open an existing document, it does not appear. My best guess is that ActiveDocument isn't getting set correctly, but I really don't know how else to implement this. I am attaching an external template to avoid making any changes to Normal.dot, but my code generates the CommandBar. I have...
by: senthilavs | last post by:
Hi, Im having word document in the Server Machine. While im trying to open the file in Client Machine file is opening in Server only. I need to open in the client only. This is an ASP.NET project done in VB.NET. The Code i used to Open the file --------------------------------------------- Dim oWordApplic As New Word.ApplicationClass Dim oDoc As Word.Document Dim strFileName As String =...
by: fab | last post by:
Hi, I'm developping a web-application on an intranet. I've got a datagrid with a button on each line. Each line represents a document (MS Word doc). These documents are on a share so that they can be saved directly on the file server. When i click on this button, it opens another windows with the word document linked to the line. But this document is open into the browser ; so i'd like the document
by: Niyazi | last post by:
Hi, I created application that store the data in SQL SERVER that reside on network. The client also use this application to access the resources provided with application. But is the client want to register new customer or companies they will enter the information in Windows Form and the program automaticaly creates the WORD document under specific folder under application path. Once the empty word file created than ask user if they want...
by: jefftim | last post by:
Hi All I've saved a word document in sql server database.I'm able to retrieve it from the database and open it in a word application. My problem is I'm able to open it in server/client machines if the operating system is win2000 but when i'm opening it in windows(XP/2003) it is saying that document not found. please try to solve my problem asap.
by: iwdu15 | last post by:
hi, how can i get the icon associated with a certain file type? thanks -- -iwdu15
by: gusa992000 | last post by:
Hello I am trying the following problem: A web app in jsp and java has to open a microsoft word document directly in the browser. This part is easy and i have done it. The user then can modify the word document. If the user 'save' the document (using the Save button of the MS tool bar in the browser) the application has to 'save as' the document on the server, not over writing the openned file but creating a new one.
by: questionit | last post by:
Hi all I have Win Xp installed in one partition and Windows Server 2003 in another partition. I have opened a Word document in Windows Server and when i tried to open the same document from Windows Xp , i got message that this document will open read-only or i have to save the docuemnt with another name if i want to write on it Similarly, from XP, when i try to perform some other tasks like connecting to internet, etc i get a message...
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.