title: C#:docx generated from html by open xml power tools throw pre release 2007
body: <p>I'm writing code that get the content of Docx file as HTML by using open XML power tools and now I want to convert it back to another docx file. the step that gets contents as HTML works fine but when I generate the docx file from that HTML the file cannot be opened and throws this error </p>
  
  <blockquote>
    <p>this file was created in a pre-release version of word 2007 and cannot
    be opened in this version</p>
  </blockquote>
  
  <p>the HTML generated from test docx is</p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
    &lt;head&gt;
      &lt;meta
        charset="UTF-8" /&gt;
      &lt;title&gt;My Page Title&lt;/title&gt;
      &lt;meta
        name="Generator"
        content="PowerTools for Open XML" /&gt;
      &lt;style&gt;span { white-space: pre-wrap; }
  p.pt-Normal {
      line-height: 107.9%;
      margin-bottom: 8pt;
      text-align: justify;
      font-family: ;
      font-size: 11pt;
      margin-top: 0;
      margin-left: 0;
      margin-right: 0;
  }
  span.pt-DefaultParagraphFont {
      font-family: ;
      font-size: 11pt;
      font-style: normal;
      font-weight: normal;
      margin: 0;
      padding: 0;
  }
  span.pt-DefaultParagraphFont-000000 {
      font-family: Calibri;
      font-size: 11pt;
      font-style: normal;
      font-weight: normal;
      margin: 0;
      padding: 0;
  }
  &lt;/style&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;div&gt;
        &lt;p
          dir="rtl"
          class="pt-Normal"&gt;&amp;#x200f;&lt;span
            lang="fa-IR"
            class="pt-DefaultParagraphFont"&gt;&amp;#x200f;با سلام خدمت &amp;#x200f;&lt;/span&gt;&lt;span
            lang="fa-IR"
            class="pt-DefaultParagraphFont"&gt;&amp;#x200f;&amp;lt;&amp;lt;&amp;#x200f;&lt;/span&gt;&lt;span
            class="pt-DefaultParagraphFont-000000"&gt;&amp;#x200e;PERSONS.lname&amp;#x200e;&lt;/span&gt;&lt;span
            lang="fa-IR"
            class="pt-DefaultParagraphFont"&gt;&amp;#x200f;&amp;gt;&amp;gt;&amp;#x200f;&lt;/span&gt;&lt;span
            lang="fa-IR"
            class="pt-DefaultParagraphFont"&gt;&amp;#x200f; &amp;#x200f;&lt;/span&gt;&lt;span
            lang="fa-IR"
            class="pt-DefaultParagraphFont"&gt;&amp;#x200f;&amp;lt;&amp;lt;&amp;#x200f;&lt;/span&gt;&lt;span
            class="pt-DefaultParagraphFont-000000"&gt;&amp;#x200e;PERSONS.fname&amp;#x200e;&lt;/span&gt;&lt;span
            lang="fa-IR"
            class="pt-DefaultParagraphFont"&gt;&amp;#x200f;&amp;gt;&amp;gt;&amp;#x200f;&lt;/span&gt;&lt;/p&gt;
        &lt;p
          dir="rtl"
          class="pt-Normal"&gt;&amp;#x200f;&lt;span
            lang="fa-IR"
            class="pt-DefaultParagraphFont"&gt;&amp;#x200f;مدیر محترم &amp;#x200f;&lt;/span&gt;&lt;span
            lang="fa-IR"
            class="pt-DefaultParagraphFont"&gt;&amp;#x200f;&amp;lt;&amp;lt;&amp;#x200f;&lt;/span&gt;&lt;span
            class="pt-DefaultParagraphFont-000000"&gt;&amp;#x200e;OFFICE.name&amp;#x200e;&lt;/span&gt;&lt;span
            lang="fa-IR"
            class="pt-DefaultParagraphFont"&gt;&amp;#x200f;&amp;gt;&amp;gt;&amp;#x200f;&lt;/span&gt;&lt;/p&gt;
      &lt;/div&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and my code to save the above html as docx is</p>
  
  <pre><code>using (WordprocessingDocument wordDoc =
          WordprocessingDocument.Create(dest_doc_path, WordprocessingDocumentType.Document))
              {
  
  
                  MainDocumentPart mainPart = wordDoc.AddMainDocumentPart();
  
                  string htmlcontent = htmlTXT.Text;
  
                  using (Stream stream = mainPart.GetStream())
                  {
                      byte[] buf = (new UTF8Encoding()).GetBytes(htmlcontent);
                      stream.Write(buf, 0, buf.Length);
                  }
  
  
                  MessageBox.Show("DONE", "done", MessageBoxButton.OK);
  
  
              }
  </code></pre>