其他分享
首页 > 其他分享> > SpringBoot excel文件下载

SpringBoot excel文件下载

作者:互联网

File file = new File(xxx);
response.setCharacterEncoding("utf-8");
response.addHeader("Content-Disposition", "attachment; filename*=UTF-8''" + URLEncoder.encode(fileName, "UTF-8") + ".xlsx");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setContentType("application/vnd.ms-excel;charset=utf-8);
response.getOutputStream().write(FileUtils.readFileToByteArray(file));

标签:UTF,SpringBoot,excel,Disposition,Content,file,response,下载
来源: https://www.cnblogs.com/lambertlt/p/16616180.html