Convert HTML to Word Document Hi! I wish to convert a HTML file to Word Document file. Is there anyway to save it as (*.doc) using Microsoft.Office.Interop library? Or is there any alternative method beside changing the file extension from (*.html) to (*.doc) because I wish to do it programmatically in C#. Thanks.© 2009 Microsoft Corporation. All rights reserved.Tue, 26 May 2009 07:10:45 Ze9866a13-d19a-46a0-8e2b-116cfb6542a6http://social.msdn.microsoft.com/Forums/en/olsbgeneral/thread/e9866a13-d19a-46a0-8e2b-116cfb6542a6#e9866a13-d19a-46a0-8e2b-116cfb6542a6http://social.msdn.microsoft.com/Forums/en/olsbgeneral/thread/e9866a13-d19a-46a0-8e2b-116cfb6542a6#e9866a13-d19a-46a0-8e2b-116cfb6542a6Yuen Lihttp://social.msdn.microsoft.com/Profile/en-US/?user=Yuen%20LiConvert HTML to Word Document Hi! I wish to convert a HTML file to Word Document file. Is there anyway to save it as (*.doc) using Microsoft.Office.Interop library? Or is there any alternative method beside changing the file extension from (*.html) to (*.doc) because I wish to do it programmatically in C#. Thanks.Tue, 02 Sep 2008 01:00:09 Z2008-09-02T01:00:09Zhttp://social.msdn.microsoft.com/Forums/en/olsbgeneral/thread/e9866a13-d19a-46a0-8e2b-116cfb6542a6#842249f2-06d4-4b77-a3d4-6f5bc6b05c14http://social.msdn.microsoft.com/Forums/en/olsbgeneral/thread/e9866a13-d19a-46a0-8e2b-116cfb6542a6#842249f2-06d4-4b77-a3d4-6f5bc6b05c14cs0kalomhttp://social.msdn.microsoft.com/Profile/en-US/?user=cs0kalomConvert HTML to Word Document Hi,  I am new here to this website.   There is a lot of great information on here.  <br><br>I was wondering if you ever found a way to do this, perhaps through another avenue.  I am curious about doing this myself.<br><br>Thank you for your help.<br><br>Best wishes to you.<br><br>BeaMon, 22 Sep 2008 22:33:25 Z2008-09-22T22:33:25Zhttp://social.msdn.microsoft.com/Forums/en/olsbgeneral/thread/e9866a13-d19a-46a0-8e2b-116cfb6542a6#7c83d4a9-3504-4589-96f9-3ae90c0293c7http://social.msdn.microsoft.com/Forums/en/olsbgeneral/thread/e9866a13-d19a-46a0-8e2b-116cfb6542a6#7c83d4a9-3504-4589-96f9-3ae90c0293c7Yuen Lihttp://social.msdn.microsoft.com/Profile/en-US/?user=Yuen%20LiConvert HTML to Word Document Hi! I did found a solution from somewhere else. You can try to open HTML file in word using Microsoft.Office.Interop.Word and save it in *.doc file type. Here are the sample codes that I used:-<br><br><font color="#0000ff" size=2> <p>object</font><font size=2> filename1 = filename;<br></font><font color="#0000ff" size=2>object</font><font size=2> oMissing = System.Reflection.</font><font color="#008080" size=2>Missing</font><font size=2>.Value;<br></font><font color="#0000ff" size=2>object</font><font size=2> readOnly = </font><font color="#0000ff" size=2>false</font><font size=2>;<br></font><font color="#0000ff" size=2>object</font><font size=2> oFalse = </font><font color="#0000ff" size=2>false</font><font size=2>;</p> <p>Microsoft.Office.Interop.Word.</font><font color="#008080" size=2>Application</font><font size=2> oWord = </font><font color="#0000ff" size=2>new</font><font size=2> Microsoft.Office.Interop.Word.</font><font color="#008080" size=2>Application</font><font size=2>();<br>Microsoft.Office.Interop.Word.</font><font color="#008080" size=2>Document</font><font size=2> oDoc = </font><font color="#0000ff" size=2>new</font><font size=2> Microsoft.Office.Interop.Word.</font><font color="#008080" size=2>Document</font><font size=2>();<br>oDoc = oWord.Documents.Add(</font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing);<br>oWord.Visible = </font><font color="#0000ff" size=2>false</font><font size=2>;</p> <p></p> <p>oDoc = oWord.Documents.Open(</font><font color="#0000ff" size=2>ref</font><font size=2> filename1, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> readOnly, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing,</font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing,</font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing);</p> <p>filename1 = </font><font color="#800000" size=2>@&quot;D:\FileConverter\Temp\new.doc&quot;</font><font size=2>;<br></font><font color="#0000ff" size=2>object</font><font size=2> fileFormat = Microsoft.Office.Interop.Word.</font><font color="#008080" size=2>WdSaveFormat</font><font size=2>.wdFormatDocument;<br>oDoc.SaveAs(</font><font color="#0000ff" size=2>ref</font><font size=2> filename1, </font><font color="#0000ff" size=2>ref</font><font size=2> fileFormat, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing,</font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing,</font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing);</p> <p></p> <p>oDoc.Close(</font><font color="#0000ff" size=2>ref</font><font size=2> oFalse, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing);<br>oWord.Quit(</font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing, </font><font color="#0000ff" size=2>ref</font><font size=2> oMissing);<br><br>Regards,<br>Yuen Li</p></font>Tue, 23 Sep 2008 00:22:47 Z2008-09-23T00:22:47Zhttp://social.msdn.microsoft.com/Forums/en/olsbgeneral/thread/e9866a13-d19a-46a0-8e2b-116cfb6542a6#407184ad-9f9e-4ab5-bec7-968146bcf701http://social.msdn.microsoft.com/Forums/en/olsbgeneral/thread/e9866a13-d19a-46a0-8e2b-116cfb6542a6#407184ad-9f9e-4ab5-bec7-968146bcf701cs0kalomhttp://social.msdn.microsoft.com/Profile/en-US/?user=cs0kalomConvert HTML to Word Document Yikes!! This looks scarey.  i'll have to try it.<br><br>Thanks!  <br><br>Bea<hr size="1" align="left" width="25%">Thanks! BeaFri, 26 Sep 2008 02:25:16 Z2008-09-26T02:25:16Zhttp://social.msdn.microsoft.com/Forums/en/olsbgeneral/thread/e9866a13-d19a-46a0-8e2b-116cfb6542a6#8c408f76-9713-4767-9df2-2ca597c79019http://social.msdn.microsoft.com/Forums/en/olsbgeneral/thread/e9866a13-d19a-46a0-8e2b-116cfb6542a6#8c408f76-9713-4767-9df2-2ca597c79019Kaushal.NEThttp://social.msdn.microsoft.com/Profile/en-US/?user=Kaushal.NETConvert HTML to Word DocumentHello,<br/> <br/>        I have done that much task as well as applying some of the formatting to document object also as like to create header,footer,border,<br/> <br/> document created successfully,but now my problem is my content is in html format now i want to display that content as a html formatted <br/> <br/> on my created word document,for that i have use <br/> <br/> <span style="color:#0000ff;font-size:x-small">object</span> <span style="font-size:x-small"> fileFormat = Microsoft.Office.Interop.Word.</span> <span style="color:#008080;font-size:x-small">WdSaveFormat</span> <span style="font-size:x-small">.wdFormatFilteredHTML;</span> <br/> <br/> then i can get proper document,but at that time document cound't affect with applied formatting means it doesn't disply header <br/> <br/> and footer, while i have change above syntax as like below<br/> <br/> <span style="color:#0000ff;font-size:x-small">object</span> <span style="font-size:x-small"> fileFormat = Microsoft.Office.Interop.Word.</span> <span style="color:#008080;font-size:x-small">WdSaveFormat</span> <span style="font-size:x-small">.wdFormatDocument;</span> <br/> <br/> then header and footer wil display but agin i m not getting html formated text on word document.<br/> <br/> now my problem is vise versa if i want to solve one problem then its create second one ....please help me to short out problem<br/> <br/> Thanks,<br/> <br/> Kaushal Pathak.<br/>Tue, 26 May 2009 07:10:44 Z2009-05-26T07:24:05Z