ActiveX controls only support IE (it seems that FF can be supported by installing plug-ins), so the method of exporting word in js is quite limited.
However, after the page is modified by js,. net cannot be obtained. Therefore, you need to use js to obtain the latest html and send it to the background to generate a file stream for download.
$ ("# Expword "). click (form = $ ("<form>" form. attr ('style', 'display: none' form. attr ('target', ''form. attr ('method', 'post' form. attr ('action', 'exportword. aspx 'input1 = $ ('<input> 'input1.attr ('type', 'did' input1.attr ('name', 'curdidhtml' input1.attr ('value ', $ ('# divArea' $ ('body'}); View Code
To transmit html content in the preceding method, you must add ValidateRequest = "false" to the Source Page and the "ExportWord. aspx" page"
After obtaining the html content, input the following method to output the word file through Response.
ExportHTML (html, HttpContext. current. response. appendHeader (, + HttpUtility. urlEncode (filename + HttpContext. current. response. contentType = HttpContext. current. response. charset = HttpContext. current. response. contentEncoding =} View Code