<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
String fileName = "最简单的导出表格.xls";
fileName = new String(fileName.getBytes("GBK"),"ISO8859_1");
response.setHeader("Content-Disposition",
"attachment;filename="+fileName);
response.setDateHeader("Expires", 0);
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Pragma", "no-cache");
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Java Execl</title>
</head>
<body>
<TABLE id="Main" cellspacing="0" cellpadding="0" border="1" width="100%">
<TBODY>
<TR >
<TH nowrap="nowrap" style="TEXT-ALIGN: center" >代理商ID</TH>
<TH nowrap="nowrap" style="TEXT-ALIGN: center" >代理商名称</TH>
<TH nowrap="nowrap" style="TEXT-ALIGN: center" >联系手机</TH>
</TR>
<TR height="30">
<TD align="center" nowrap="nowrap"> July</TD>
<TD align="center" nowrap="nowrap"> 男</TD>
<TD align="center" nowrap="nowrap"> 羽毛球</TD>
</TR>
</TBODY>
</TABLE>
</body>
</html>
Java保存页面的内容为任意格式
最新推荐文章于 2021-02-13 18:22:28 发布