Export contents inside <div> as a .docx File
<p>I am having trouble exporting the contents of a div into a <strong>.docx</strong> file. I am using <strong>FileSaver.js</strong> which can be found here: <a href="https://github.com/eligrey/FileSaver.js/" rel="nofollow noreferrer">https://github.com/eligrey/FileSaver.js/</a>.</p>

<p>My JavaScript Function: </p>

<pre><code>function exportNote(){
   var blob = new Blob([document.getElementById('editor').innerHTML], {
      type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document;charset=utf-8"
   });
   saveAs(blob, "note.docx");
}
</code></pre>

<p>I get a download that appears to be a word file but when I open it I get the following error:</p>

<blockquote>
  <p>The Open XML file note.docx cannot be opened because 
      there are problems with the contents or the file name 
      might contain invalid characters (for example. /).</p>
  
  <p>Details: 
      The file is corrupt and cannot be opened.</p>
</blockquote>

<p>For graphical purposes:</p>

<p><a href="https://i.stack.imgur.com/yjqtl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yjqtl.png" alt="enter image description here"></a></p>

<p>The text area is the area I am trying to export into a word document which is under <code>&lt;div id="editor"&gt;&lt;/div&gt;</code>. </p>