java输出response流文件,配合vue进行excel流文件下载
HSSFWorkbook wb = ExcelExportUtil.toExportHos(new String[]{"管理机构", "医院编码", "医院名称", "医院等级", "年案件量", "目标医院状态"},hosList);response.setContentTyp
·
HSSFWorkbook wb = ExcelExportUtil.toExportHos(new String[]{"管理机构", "医院编码", "医院名称", "医院等级", "年案件量", "目标医院状态"},hosList);
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
response.setCharacterEncoding("UTF-8");
try {
response.setHeader("Content-Disposition", "attachment;filename="+
java.net.URLEncoder.encode("医院信息数据导出.xls","UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
try {
OutputStream os = response.getOutputStream();
wb.write(os);
os.flush();
os.close();
wb = null;
}catch(IOException e){
e.printStackTrace();
}
更多推荐
已为社区贡献4条内容
所有评论(0)