title: How to convert docx to html file using open xml with formatting
body: <p>I know there are lot of question having same title but I am currently having some issue for them I didn't get the correct way to go.</p>
  
  <p>I am using Open xml sdk 2.5 along with <a href="http://powertools.codeplex.com/" rel="noreferrer">Power tool</a> to convert <code>.docx</code> file to <code>.html</code> file which uses <code>HtmlConverter</code> class for conversion. </p>
  
  <p>I am successfully able to convert the <code>docx</code> file into the <code>Html</code> file but the problem is, html file doesn't retain the original formatting of the document file. eg. <em>Font-size,color,underline,bold</em> etc doesn't reflect into the html file.</p>
  
  <p>Here is my existing code:</p>
  
  <pre><code>public void ConvertDocxToHtml(string fileName)
  {
     byte[] byteArray = File.ReadAllBytes(fileName);
     using (MemoryStream memoryStream = new MemoryStream())
     {
        memoryStream.Write(byteArray, 0, byteArray.Length);
        using (WordprocessingDocument doc = WordprocessingDocument.Open(memoryStream, true))
        {
           HtmlConverterSettings settings = new HtmlConverterSettings()
           {
              PageTitle = "My Page Title"
           };
           XElement html = HtmlConverter.ConvertToHtml(doc, settings);
           File.WriteAllText(@"E:\Test.html", html.ToStringNewLineOnAttributes());
        }
      }
   }
  </code></pre>
  
  <p>So I just want to know if is there any way by which I can retain the formatting in converted HTML file.</p>
  
  <p>I know about some third party APIs which does the same thing. But I would prefer if there any way using open xml or any other open source to do this.</p>