Note that there are some explanatory texts on larger screens.

plurals
  1. POI want Convert a Html page with all its content i.e. images like .png,.gif to ms word document with the same look and feel
    text
    copied!<p>Can any one help me to convert a html page and its content to Microsoft Word file . Basically what i want is a ms word page which looks like my html page in Browser.</p> <p>i am using this code can any one suggest me something else.</p> <pre><code>object filename1 = @"html file path"; object oMissing = System.Reflection.Missing.Value; object readOnly = false; object oFalse = false; Microsoft.Office.Interop.Word.Application oWord = new Microsoft.Office.Interop.Word.Application(); Microsoft.Office.Interop.Word.Document oDoc = new Microsoft.Office.Interop.Word.Document(); oDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing); oWord.Visible = false; oDoc = oWord.Documents.Open(ref filename1, ref oMissing, ref readOnly, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing); if (!Directory.Exists(@"D:\FileConverter\Temp\new.doc"))//path of destination file. { Directory.CreateDirectory(@"D:\FileConverter\Temp"); } if (!File.Exists(@"D:\FileConverter\Temp\new.doc")) { File.Create(@"D:\FileConverter\Temp\new.doc"); } filename1 = @"D:\FileConverter\Temp\new.doc"; object fileFormat = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatDocument; oDoc.SaveAs(ref filename1, ref fileFormat, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing); oDoc.Close(ref oFalse, ref oMissing, ref oMissing); oWord.Quit(ref oMissing, ref oMissing, ref oMissing); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload