jsp导出word

来源:互联网 发布:德佳软件 编辑:程序博客网 时间:2024/05/01 09:57
<%@ page contentType="application/vnd.ms-word; charset=utf-8"%><%@ page pageEncoding="utf-8"%> <%      String fileName = "jsp导出word.doc";        //对中文文件名编码     //fileName = URLEncoder.encode(fileName, "utf-8");      byte[] yte = fileName.getBytes("GB2312");              String unicoStr = new String(yte, "ISO-8859-1");   response.setHeader("Content-disposition", "attachment; filename=" + unicoStr);  %>   <html xmlns:v="urn:schemas-microsoft-com:vml"         xmlns:o="urn:schemas-microsoft-com:office:office"         xmlns:w="urn:schemas-microsoft-com:office:word"         xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"         xmlns:st1="urn:schemas-microsoft-com:office:smarttags"         xmlns="http://www.w3.org/TR/REC-html40">  <head>  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">  <meta name="ProgId" content="Word.Document">  <meta name="Generator" content="Microsoft Word 12">  <meta name="Originator" content="Microsoft Word 12">   <title>JSP页面导出为Word文档</title>  </head>  <body>  。。。页面内容。。。  </body>  </html> 

 


 http://blog.sina.com.cn/s/blog_59e2a4100100kejd.html
0 0
原创粉丝点击