700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > easyexcel结合zip 导出压缩文件(包含多个excel)

easyexcel结合zip 导出压缩文件(包含多个excel)

时间:2022-02-23 23:43:09

相关推荐

easyexcel结合zip 导出压缩文件(包含多个excel)

easyexcel结合zip 导出压缩文件(包含多个excel)

直接上代码… 分批次查询处理示例代码

int limit = 1;int pageNum = 500;ByteArrayOutputStream bos = new ByteArrayOutputStream();ZipOutputStream out = new ZipOutputStream(bos);try {while (true) {params.put("limit", limit);params.put("pageNum", pageNum);List<GoodsSpecExportExcel> excelList = goodsSpecService.findSkuListByParams(params);ByteArrayOutputStream out1 = new ByteArrayOutputStream();EasyExcel.write(out1, GoodsSpecExportExcel.class).sheet().doWrite(excelList);out1.close();out.putNextEntry(new ZipEntry(System.currentTimeMillis() + ".xls"));byte[] excelStream = out1.toByteArray();out.write(excelStream);limit++;if (excelList.size()<500) {break;}}} catch (Exception e) {e.printStackTrace();} finally {out.close();bos.close();}

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