在jsp页面导出word文件(超简单)

加入:<%@ page contentType="application/msword; charset=GBK" %>
加入:<% 
		response.setHeader("Content-Disposition", "attachment; filename=" + java.net.URLEncoder.encode("idea.doc", "GBK"));  
	%>

<%@ page language="java" pageEncoding="GBK"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page contentType="application/msword; charset=GBK" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<% 
			response.setHeader("Content-Disposition", "attachment; filename=" + java.net.URLEncoder.encode("idea.doc", "GBK"));  
		%>
	</head>
	<body>
		<div style="text-align:center;">
			<table style="width: 80%;">
				<tr>
					<td colspan="4" style="text-align: center;font-size: 25px;font-weight: bold;">
						签署意见
					</td>
				</tr>
				<tr style="font-weight: bold;">
					<td>
						步骤名称
					</td>
					<td>
						办理人
					</td>
					<td>
						办理时间
					</td>
					<td>
						办理意见
					</td>
				</tr>					
				<tr>
					<td>1</td>
					<td>2</td>
					<td>3</td>
					<td>4</td>
				</tr>					
			</table>
		</div>
	</body>
</html>

 

你可能感兴趣的:(java,html,.net,jsp,idea)