473,594 Members | 2,663 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;
  2.  
  3.  string DocPath = System.Configuration.ConfigurationManager.AppSettings["VirtualDocPath"];
  4.  
  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;
  14.  
  15.             // here on Document.Open there should be 9 arg.
  16.             //Word.Document doc = new Document();
  17.             //Microsoft.Office.Interop.Word.Document doc;
  18.  
  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);
  23.  
  24.  
  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;
  28.  
  29.             string m_Content = doc1.Content.Text;
  30.  
  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.             }
  38.  
  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

Saket
Sep 4 '09 #1
2 4425
Frinavale
9,735 Recognized Expert Moderator Expert
Is Microsoft office 2007 installed on the server?
Sep 4 '09 #2
saketmayur
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

1
5607
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...
0
2405
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 =...
1
1610
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
0
3220
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...
2
3039
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.
1
2414
by: iwdu15 | last post by:
hi, how can i get the icon associated with a certain file type? thanks -- -iwdu15
2
15343
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.
4
1590
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...
0
7882
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8259
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, 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...
0
8377
jinu1996
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...
1
8016
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,...
0
6669
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
3871
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...
0
3905
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1487
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1218
bsmnconsultancy
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.