List<ExportByNoSkuVo> exportBySkuVoList = invLotLocExportService.exportByNoSku(invLotLocIdPageDto);
Workbook workbook = ExcelExportUtil.exportBigExcel(new ExportParams("库存管理", "库存管理"), ExportByNoSkuVo.class, exportBySkuVoList);
ExcelExportUtil.closeExportBigExcel();
ioExport(response, workbook, "库存管理.xls");
return RestfulApiResponse.success("success",exportBySkuVoList);
/**
* 导出io流
*
* @param filename 文件名
*/
private void ioExport(HttpServletResponse response, Workbook workbook, String filename) {
try {
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8"));
workbook.write(response.getOutputStream());
} catch (IOException e) {
e.printStackTrace();
}
}
java 操作 EasyPoi实现大数据的导出 简单实用
最新推荐文章于 2024-07-01 08:49:03 发布