Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello

I am trying to build an application using ASP.NET MVC in which I have to view a word doc in a view. I searched a lot on the web and found that Microsoft.Office.Interop.Office can be used for this. The following are ( I guess ) the most important lines in the present code...

Application objWord = new Application();

objWord.Documents.Open(ref sourceFilePath, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing,ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing);

objWord.Visible = false;

Microsoft.Office.Interop.Word.Document oDoc = objWord.ActiveDocument;

oDoc.SaveAs(ref savefilename, ref fltDocFormat, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);


I am trying to convert the doc file to htm format first, after which I will use iframe to view the document in the view.

But when I debug, the following exception is thrown at the "Application objWord = new Application()" line...

Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

Can some one please help me.

Thanks.
Posted
Updated 14-Mar-11 11:04am
v3
Comments
Wendelius 14-Mar-11 17:05pm    
Added pre tags

1 solution

Based on the error code looks like Word isn't installed on the server at all. In order to use interop you must install it.
 
Share this answer
 
Comments
Amit Ahl 14-Mar-11 17:13pm    
I have word starter 2010 installed on my machine....is that the reason for the problem?
Wendelius 14-Mar-11 17:20pm    
Could be, I'm really not familiar with that edition.
hharris 29-Apr-11 20:34pm    
So far I also have not had any luck with getting Word Starter edition to work with COM objects. Did you figure out a workaround?

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