The simple implementation of Js2word/html2word is described in C # as follows: StringBuilder SB = new StringBuilder ();
Sb. Append ("Sb. Append ("xmlns:o= ' Urn:schemas-microsoft-com:office:office '");
Sb. Append ("xmlns:w= ' Urn:schemas-microsoft-com:office:word '");
Sb. Append ("xmlns= ' http://www.w3.org/TR/REC-html40 ' >");
Sb. Append ("
Sb. Append ("<!--[if GTE mso 9]>");
Sb. Append ("<xml>");
Sb. Append ("<w:WordDocument>");
Sb. Append ("<w:View>Print</w:View>");
Sb. Append ("<w:Zoom>90</w:Zoom>");
Sb. Append ("<w:DoNotOptimizeForBrowser/>");
Sb. Append ("</w:WordDocument>");
Sb. Append ("</xml>");
Sb. Append ("<![ Endif]--> ");
Sb. Append ("<style>");
Sb. Append ("<!--/* Style Definitions */");
Sb. Append ("@page Section1");
Sb. Append ("{size:8.5in 11.0in;");
Sb. Append ("margin:1.0in 1.25in 1.0in 1.25in;");
Sb. Append ("mso-header-margin:.5in;");
Sb. Append ("mso-footer-margin:.5in; mso-paper-source:0;} ");
Sb. Append ("Div. Section1 ");
Sb. Append ("{page:section1;}");
Sb. Append ("--");
Sb. Append ("</style>
Sb. Append ("<body lang=en-us style= ' tab-interval:.5in ' >");
Sb. Append ("<div class=" Section1 ">");
Sb. Append ("Sb. Append ("<p style= ' color:red ' ><I>");
Sb. Append (DateTime.Now + "</I></p>");
Sb. Append ("Sb. Append ("</div></body>
Response.appendheader ("Content-type", "Application/msword");
Response.appendheader ("Content-disposition", "attachment; Filename=myword.doc ");
Response.Write (sb.) ToString ()); JavaScript version please refer to the following example, self-modification: js2excel/html2excel Simple implementation
Simple implementation of Js2word/html2word