Using JavaScript to "Create" a Microsoft Word Document
<p>I would like to dynamically create a document using JavaScript and then open that document in Microsoft word.  Is this possible?  Here is my current code:</p>

<pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;

       &lt;script src="js/jquery-1.4.4.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;

  &lt;div id="myDiv"&gt;The quick brown fox jumped lazly over the dead log.&lt;/div&gt;

  &lt;script type="text/jscript"&gt;
     var printWindow = window.open("", "Print", "width=800,height=400,scrollbar=0");
     var printAreaHtml = $("#myDiv").attr("outerHTML");

     printWindow.document.open("text/html", "replace");
     printWindow.document.writeln("&lt;html&gt;&lt;head&gt;")
     printWindow.document.writeln("&lt;meta HTTP-EQUIV='Content-Type'  content='application/vnd.ms-word'&gt;");
printWindow.document.writeln("&lt;meta HTTP-EQUIV='Content-Disposition' content='attachment;filename=print.doc'&gt;");
printWindow.document.writeln("&lt;/head&gt;");
printWindow.document.writeln("&lt;body&gt;");
printWindow.document.write(printAreaHtml);

printWindow.document.writeln("&lt;/body&gt;");
printWindow.document.writeln("&lt;/html&gt;");
printWindow.document.close();
</code></pre>

<p>//    printWindow.print();     </p>

<p></p>

<p>
</p>
