EasyPOI根据模板导出多Sheet页Excel java
@GetMapping(value = "downloadtest") public void downloadtest(HttpServletRequest request, HttpServletResponse response) throws IOException { List<Map<String, Object>> reportMoneyExportList = new ArrayList<>(); Map<String, Object> moneyExport = new HashMap<>(); moneyExport.put("seq", "1"); moneyExport.put("projectId", "2"); moneyExport.put("name", 3); Map<String, Object> moneyExport1 = new HashMap<>(); moneyExport1.put("seq", "112122"); moneyExport1.put("projectId", "22122"); moneyExport1.put("name", 333); reportMoneyExportList.add(moneyExport); reportMoneyExportList.add(moneyExport1); TemplateExportParams params = new TemplateExportParams("D:\\drgTest.xls", true); params.setStyle(ExcelStyleType.BORDER.getClazz()); Map<String, Object> map = new HashMap<String, Object>(); map.put("dataList", reportMoneyExportList); map.put("dataList2", reportMoneyExportList); Workbook book = ExcelExportUtil.exportExcel(params, map); File savefile = new File("D:/excel/"); if (!savefile.exists()) { savefile.mkdirs(); } FileOutputStream fos = new FileOutputStream("D:/excel/test.xls"); book.write(fos); fos.close(); }
Sheet1

Sheet2

    人生的成功不在于拿到一副好牌,而是怎样将坏牌打好。

 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号