-1

I want to convert .doc to .htm in C#. If I use Microsoft.Office.Interop.Word I get the 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))

Any solutions?

[The possibe duplicate is this: C# convert .doc to .htm, but it does not solve my problem.]

Community
  • 1
  • 1
user1340852
  • 825
  • 3
  • 9
  • 27
  • 2
    You can show your code here.. – Soner Gönül Apr 02 '13 at 10:39
  • do you have ms-office installed on your machine..? – Sachin Apr 02 '13 at 10:41
  • I dont have a code for this right now, but I got the code for converting doc to .xps and for this I think I would need the same libraries, the very first line has a problem: Microsoft.Office.Interop.Word.Application wordApplication = new Microsoft.Office.Interop.Word.Application(); – user1340852 Apr 02 '13 at 10:42
  • Yes I have the Starter Version 2010. – user1340852 Apr 02 '13 at 10:43
  • Okay I have figured out that the Starter Version of Word does not support the COM libraries, so is there a work around this problem? or is there a way to cnvert doc to htm without using Microsoft.Interop.Word ? – user1340852 Apr 02 '13 at 11:10
  • @user1340852 - The solution is not to use the Starter version of Word if you want to use the Office COM library. – Security Hound Apr 02 '13 at 12:27

2 Answers2

1

What you can do is to read the doc/docx file using 3rd party dll and then write the data to html format using HtmlTextWriter

check out this stackoverflow questions:

Convert word to pdf using free third party dll

Reading doc and docx files using C# without having MS Office installed on server

The links provided in the above questions are:

for docx:

http://docx.codeplex.com/

http://msdn.microsoft.com/en-us/library/bb656295%28office.12%29.aspx

for doc:

http://npoi.codeplex.com/

Community
  • 1
  • 1
th1rdey3
  • 4,176
  • 7
  • 30
  • 66
0

The CLSID {000209FF-0000-0000-C000-000000000046} of the object needs to be in the registry.

The interop assemblies are wrappers that use the COM dlls provided by MS Office. So at some layer you use COM, although it's transparent to you.

Please check if you installed the interop stuff for MS Office.See this link http://msdn.microsoft.com/en-us/library/aa159923%28office.11%29.aspx You can check if you have the interop assemblies for MS Word installed.

Vishwanath Kamath
  • 340
  • 2
  • 3
  • 14