Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have the error INTERFACE NOT REGISTERED (Exception From HRESULT:0x80040155) while reading word file from server and it works fine on my local system.....please help




C#
object missingType = Type.Missing;
                   object readOnly = true;
                   object isVisible = false;
                   object documentFormat = 8;
                   object htmlFilePath = Server.MapPath("~/Uploads/Resume/Temp/") + Resume + ".htm";
                   string directoryPath = Server.MapPath("~/Uploads/Resume/Temp/") + Resume + "_files";

                   object fileName = Server.MapPath("~/Uploads/Resume/" + Resume);//FileUpload1.PostedFile.FileName;

                   //Open the word document in background
                   ApplicationClass applicationclass = new ApplicationClass();
                   applicationclass.Documents.Open(ref fileName,
                                                   ref readOnly,ref missingType, ref missingType, ref missingType,ref missingType, ref missingType, ref  missingType,ref missingType, ref missingType, ref isVisible,ref missingType, ref missingType, ref missingType,ref missingType, ref missingType);
                   applicationclass.Visible = false;
                   Document document = applicationclass.ActiveDocument;



                   //Save the word document as HTML file
                   document.SaveAs(ref htmlFilePath, ref documentFormat, ref missingType,
                                   ref missingType, ref missingType, ref missingType,
                                   ref missingType, ref missingType, ref missingType,
                                   ref missingType, ref missingType, ref missingType,
                                   ref missingType, ref missingType, ref missingType,
                                   ref missingType);


                   //Close the word document
                   document.Close(ref missingType, ref missingType, ref missingType);

                   iframe.Attributes.Add("src", "../Uploads/Resume/Temp/" + Resume + ".htm");
Posted
Updated 19-Jun-14 21:10pm
v4
Comments
CHill60 19-Jun-14 4:37am    
How are you reading the file? Post the relevant code
Namith Krishnan E 19-Jun-14 5:38am    
?
[no name] 19-Jun-14 6:24am    
http://www.google.com/search?q=INTERFACE+NOT+REGISTERED
Namith Krishnan E 20-Jun-14 0:14am    
I had already googled it and not found any solution
[no name] 20-Jun-14 6:57am    
If you had googled it, you would have found the solution. Why do you think Microsoft tells people not to do this very thing?

1 solution

Such a simple thing: Word is not installed on the server (or only an older version of it).
And, no, it is not a good idea to use Word (or other MS Office products) on a server. Look for alternative libraries for dealing with MS Office files.
 
Share this answer
 
Comments
Namith Krishnan E 20-Jun-14 7:34am    
I have already installed word on server (only word 2007 from office package) before word installing the Microsoft.Office.Interop.Word.dll cant be found on server.After installing word the error becomes interface not registered

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900