<%@ page language="java" contentType="application/vnd.ms-excel; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<!-- 将页面的响应方式改为excel -->
<%
response.setContentType("application/vnd.ms-excel");
response.addHeader("Content-Disposition", "attachment;filename=" + new String(("客户积分统计表").getBytes("gb2312"),"iso8859-1") + ".xls");
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<table width="800">
<tr align="center" style="font: 30px" height="40" bgcolor="red">
<th colspan="6">标题</th>
</tr>
<tr height="30">
<td>单元:单元值</td>
<td colspan="5" ALIGN="center">单元: 单元值</td>
</tr>
</table>
<table border="1" width="800" style="border-collapse: collapse">
<tr height="35" ALIGN="center">
<th width="100">单元</th>
<td colspan="5"><label> </label>单元值</td>
</tr>
<tr height="35" ALIGN="center">
<th width="100">单元</th>
<td colspan="2">单元值</td>
<th width="150">单元</th>
<td colspan="2">单元值</td>
</tr>
<tr height="100" ALIGN="center">
<th width="100">单元</th>
<td ALIGN="left" colspan="5"><label> </label>单元值</td>
</tr>
<tr height="100" ALIGN="center">
<th width="100">单元</th>
<td ALIGN="left" colspan="5"><label> </label>单元值</td>
</tr>
</table>
</body>
</html>
说明:
只需将数据传进本页面,改写table中的tr、td,相当于excel中的行列,即可。