1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > easypoi导出csv文件 wps打开正常 excel打开乱码解决方案

easypoi导出csv文件 wps打开正常 excel打开乱码解决方案

时间:2022-12-24 14:40:06

相关推荐

easypoi导出csv文件 wps打开正常 excel打开乱码解决方案

/*** csv 导出*/public static<T> void exportCsvFile(HttpServletResponse response, List<T> list) throws Exception{response.setHeader("content-Type", "text/csv");response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("测试" + ".csv", "utf-8"));//导出csv乱码,设置ServletOutputStream outputStream = response.getOutputStream();outputStream.write(new byte[]{(byte)0xEF, (byte)0xBB, (byte)0xBF});CsvExportParams csvExportParams = new CsvExportParams();csvExportParams.setEncoding("utf-8");outputStream.flush();CsvExportUtil.exportCsv(csvExportParams, User.class,list, outputStream);}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。