html导出为word
来源:互联网 发布:中科大计算机 知乎 编辑:程序博客网 时间:2024/05/24 06:53
后台代码:
HttpContext.Current.Response.Buffer = true; HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, System.Text.Encoding.UTF8) + "_" + Utils.GetRandomCode(5, 0) + ".doc"); HttpContext.Current.Response.Charset = "gb2312"; HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default; HttpContext.Current.Response.ContentType = "application/ms-word"; System.IO.StringWriter tw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw); HttpContext.Current.Response.Write(HTML); HttpContext.Current.Response.End();
前端:
function ExportExl(strXlsName, html) { var f = $('<form action="http://localhost:25992/Handler/ExportWordHandler.ashx" method="post" id="fm1"></form>'); var i = $('<input type="hidden" id="txtHtmlContent" name="txtHtmlContent" />'); var l = $('<input type="hidden" id="txtHtmlName" name="txtHtmlName" />'); i.val(encodeURI(html)); i.appendTo(f); l.val(strXlsName); l.appendTo(f); f.appendTo(document.body).submit(); try { document.body.removeChild(f); } catch (e) { } }
0 0
- html导出为word
- javascript Html 导出为word excel
- java后台html导出为word文件
- IE下用JavaScript将HTML导出为Word、Pdf
- IE下用JavaScript将HTML导出为Word、Pdf
- html方式导出word
- 将html导出word
- word转化为html
- word 转化为HTML
- 关于HTML的word导出
- response导出html到word
- html页面导出word文档
- html导出 word文档教程
- 用Freemarker导出为word
- PowerDesigner导出为word文档
- jfreechart一&二维报表导出为word&pdf&html-中文乱码和字体模糊问题(一)
- jfreechart一&二维报表导出为word&pdf&html-报表上显示百分比或数字(二)
- web项目java后台将html表格导出为word表格文件
- RDD行动Action操作(1)–first、count、reduce、collect
- 技术领导”不等于“技术管理”
- wamp和Eclipse搭建PHP环境
- 超融合 - 数据中心2015年的新概念
- 十四章上机练习1
- html导出为word
- Windows 10 上强制Visual Studio以管理员身份运行
- RDD行动Action操作(2)–take、top、takeOrdered
- ThoughtWorks面试体验
- 模仿android4.0的 通知栏 listview 滑动删除 item ,有滑动动画。
- 7- 代码段权限检查与 jmp
- NGINX+THINKPHP配置注意
- Java编写杨辉三角
- React-native 出bug 记录