Commit 169358a5 authored by tangwei's avatar tangwei

修复下载乱码

parent 2538852e
......@@ -870,12 +870,16 @@ public static void exportExcel(List<Map<String, Object>> list, String fileName,
private static void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) {
try {
String name = new String(fileName.getBytes("UTF-8"), "ISO8859_1");
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition",
"attachment;filename=" + name);
// String name = new String(fileName.getBytes("UTF-8"), "ISO8859_1");
// response.setHeader("content-Type", "application/vnd.ms-excel");
// response.setHeader("Content-Disposition",
// "attachment;filename=" + name);
response.setCharacterEncoding("UTF-8");
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition",
"attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
workbook.write(response.getOutputStream());
workbook.write(response.getOutputStream());
} catch (IOException e) {
throw new YeeException(e.getMessage());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment