将工作簿响应到浏览器下载
public static void writeWorkbookToResponse(HttpServletResponse response, Workbook wb, String fileName){
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + new String((fileName+".xlsx").getBytes(), StandardCharsets.ISO_8859_1));
try (OutputStream os = response.getOutputStream()) {
wb.write(os);
wb.close();
os.flush();
} catch (Exception e){
log.error(e.getMessage());
}
}