Technology sharing

facile poi instrumentis dynamicis columnis (titles) et multi-sheet exportatis ad excel

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

Linteamen dynamice exportat, pseudocode, ac refert objectum workbook

  1. List<Map<String, Object>>list = new ArrayList<Map<String, Object>>();
  2. HashMap<String, Object> map = new HashMap<>();
  3. map.put("name", "小明");
  4. map.put("age", "18");
  5. list1.add(map);
  6. List<ExcelExportEntity> entitys=new ArrayList<>();
  7. entitys.add(new ExcelExportEntity("名字" ,"name"));
  8. entitys.add(new ExcelExportEntity("年龄" ,"age"));
  9. ExportParams exportParams = new ExportParams(null, "sheet1名字");
  10. exportParams.setType(ExcelType.XSSF);
  11. Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);

Exportatio dynamica plurium schedae, pseudocode, et creatio obiecti operis referti

  1. List<Map<String, Object>> sheet1ListMap= new ArrayList<Map<String, Object>>();
  2. List<Map<String, Object>> sheet2ListMap= new ArrayList<Map<String, Object>>();
  3. List<ExcelExportEntity> sheet1List=new ArrayList<>();
  4. sheet1List.add(new ExcelExportEntity("名字" ,"name"));
  5. sheet1List.add(new ExcelExportEntity("年龄" ,"age"));
  6. List<ExcelExportEntity> sheet2List=new ArrayList<>();
  7. sheet2List.add(new ExcelExportEntity("学号" ,"sno"));
  8. sheet2List.add(new ExcelExportEntity("课程" ,"course"));
  9. ExportParams exportParams1 = new ExportParams(null, "sheet1名字");
  10. exportParams1.setType(ExcelType.XSSF);
  11. ExportParams exportParams2 = new ExportParams(null, "sheet2名字");
  12. exportParams2.setType(ExcelType.XSSF);
  13. Workbook workbook = new XSSFWorkbook();
  14. ExcelExportService service = new ExcelExportService();
  15. // 创建sheet1,执行的先后顺序
  16. service.createSheetForMap(workbook, exportParams1, sheet1List, sheet1ListMap);
  17. // 创建sheet2
  18. service.createSheetForMap(workbook, exportParams2, sheet2List, sheet2ListMap);

Nota: Modus creandiSheetForMap() restrictiones usus habet, et notitiae exportatae nullae esse non possunt.Si forma cum capitis tantum et nulla notitia exportare debes, entitatis genus et annotationes utere debes creare.

Documenta relatio:facile-poi instrumentorum operationum sicut columnae dynamicae (titles), multi-schedae exportationis documentorum praestantium, etc.