Simple implementation of Js2word/html2word

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.