jsp 导出excel

xiaoxiao2022-06-13  42

当触发导出excel表格动作时,指定跳到下面这个JSP页面,浏览器会自动弹出下载提示框。 <%@ page contentType="application/vnd.ms-excel; charset=gbk" %><%@ page language="java" pageEncoding="GBK"%><% String filename = new String(("表格名").getBytes("GBK"),"ISO-8859-1"); response.addHeader("Content-Disposition", "filename=" + filename + ".xls");%><html><head> <meta name="Generator" content="Microsoft Excel 11"> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head><body ><center><b>表格名</b></center><br> <table border="1" align="center" cellpadding="0" cellspacing="1"> <tr > <td> <!--在这里用html写表格内容的代码,可以用jsp代码--> </td> </tr> </table></body></html> 表格的格式会按html的格式展现。 相关资源:jsp页面导出excel
转载请注明原文地址: https://www.6miu.com/read-4936205.html

最新回复(0)