Java代码加:
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=" + new String((userExpandDto.getRealname() + "学员个人档案").getBytes(),"ISO8859-1") + ".xls");
jsp页面加:
<html xmlns:x="urn:schemas-microsoft-com:office:excel">
<head>
??<!-- 显示网格线 -->
??<xml>
?????<x:ExcelWorkbook>
????????<x:ExcelWorksheets>
???????????<x:ExcelWorksheet>
??????????????<x:Name>excel</x:Name>
??????????????<x:WorksheetOptions>
?????????????????<x:Print>
????????????????????<x:ValidPrinterInfo/>
?????????????????</x:Print>
??????????????</x:WorksheetOptions>
???????????</x:ExcelWorksheet>
????????</x:ExcelWorksheets>
?????</x:ExcelWorkbook>
??</xml>
??<!-- 显示网格线 -->
??<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
jsp 文件导出到Excel
原文地址:http://www.cnblogs.com/gc-note/p/7744892.html