Hi ,
I have write the following code to open word document on server
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
I have write the following code to open word document on server
Code:
using Microsoft.Office.Interop.Word; string DocPath = System.Configuration.ConfigurationManager.AppSettings["VirtualDocPath"]; ApplicationClass wordApp = new ApplicationClass(); string filePath = ""; filePath = DocPath + Session["username"] + "/" + DocFile.Value.ToString(); lblPath.Text = Server.MapPath("~/Document/" + Session["username"]) + "/" + DocFile.Value.ToString(); object file = filePath; object readOnly = false; object isVisible = true; object nullobj = System.Reflection.Missing.Value; wordApp.Visible = false; // here on Document.Open there should be 9 arg. //Word.Document doc = new Document(); //Microsoft.Office.Interop.Word.Document doc; Microsoft.Office.Interop.Word.Document doc = wordApp.Documents.Open(ref file, ref nullobj, ref readOnly, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref isVisible, ref nullobj, ref nullobj, ref nullobj, ref nullobj); // Here the word content is copeied into a string which helps to // store it into textbox. Microsoft.Office.Interop.Word.Document doc1 = wordApp.ActiveDocument; string m_Content = doc1.Content.Text; // the content is stored into the textbox. if (sMode.Trim() == "ReadOnly") { txtdocument.ReadOnly = true; btnSave.Visible = false; btnEsign.Visible = false; } txtdocument.Text = m_Content; 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
Comment