I am trying to convert .doc file to .htm format to view in an ASP.NET MVC page.
I am using the following code in C# :
using Microsoft.Office.Core;
using Microsoft.Office.Interop.Word;
....
Microsoft.Office.Interop.Word.Application objWord = new Microsoft.Office.Interop.Word.Application();
object source = @"C:\Users\XYZ\Desktop\ScreenShot.doc";
object target = @"C:\Users\XYZ\Desktop\ScreenShot.html";
object unknown = Type.Missing;
objWord.Documents.Open(ref source, ref unknown,
ref unknown, ref unknown, ref unknown,
ref unknown, ref unknown, ref unknown,
ref unknown, ref unknown, ref unknown,
ref unknown, ref unknown, ref unknown, ref unknown);
object format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatRTF;
objWord.ActiveDocument.SaveAs(ref target, ref format,
ref unknown, ref unknown, ref unknown,
ref unknown, ref unknown, ref unknown,
ref unknown, ref unknown, ref unknown,
ref unknown, ref unknown, ref unknown,
ref unknown, ref unknown);
I have tried to google the way to convert .doc ( even .ppt ) to .htm format and have always found code somewhat similar to the above.
But I keep getting this exception :
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)).
at the line :
Microsoft.Office.Interop.Word.Application objWord = new Microsoft.Office.Interop.Word.Application();
Is this due to the reason that I have a Word Starter 2010 installed and not the complete Office 2010, or is there some other solution to it ?