@RequestMapping(value = "/excel/export")
public void exportExcel(HttpServletResponse response) {
try {
String filename ="应急多发线路统计";
OutputStream os = response.getOutputStream();// 取得输出流
response.reset();// 清空输出流
response.setCharacterEncoding("utf-8");
// 取得文件名。
response.setContentType("application/x-msdownload");
response.setHeader("Content-Disposition", "attachment;filename= "+new String(filename.getBytes("gb2312"),"iso8859-1")+".xls");
WritableWorkbook book = Workbook.createWorkbook(os);
// 生成名为“第一页”的工作表,参数0表示这是第一页
WritableSheet sheet = null;
emmOftenRoadService.creteEcxel(sheet,book);
book.write();
book.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public void exportExcel(HttpServletResponse response) {
try {
String filename ="应急多发线路统计";
OutputStream os = response.getOutputStream();// 取得输出流
response.reset();// 清空输出流
response.setCharacterEncoding("utf-8");
// 取得文件名。
response.setContentType("application/x-msdownload");
response.setHeader("Content-Disposition", "attachment;filename= "+new String(filename.getBytes("gb2312"),"iso8859-1")+".xls");
WritableWorkbook book = Workbook.createWorkbook(os);
// 生成名为“第一页”的工作表,参数0表示这是第一页
WritableSheet sheet = null;
emmOftenRoadService.creteEcxel(sheet,book);
book.write();
book.close();
} catch (Exception e) {
e.printStackTrace();
}
}