为啥后面的数据离表头越来越远了,是我的数据和表头没对应上吗
代码如下所示
List<ExcelExportEntity> exportList = new ArrayList<>();
// 创建最底部的一级表头10个
ExcelExportEntity A1 = new ExcelExportEntity("一级表头A1", "a1", 30);
ExcelExportEntity A2 = new ExcelExportEntity("一级表头A2", "a2", 30);
ExcelExportEntity B1 = new ExcelExportEntity("一级表头B1", "b1", 30);
ExcelExportEntity B2 = new ExcelExportEntity("一级表头B2", "b2", 30);
ExcelExportEntity B3 = new ExcelExportEntity("一级表头B3", "b3", 30);
// 创建二级表头,并将二级表头对应的下级一级表头放入其中,以此类推...
ExcelExportEntity A = new ExcelExportEntity("二级表头A", "a");
A.setList(Arrays.asList(A1, A2));
ExcelExportEntity B = new ExcelExportEntity("二级表头B", "b");
B.setList(Arrays.asList(B1, B2, B3));
ExcelExportEntity E = new ExcelExportEntity("最终成绩", "sumScore");
ExcelExportEntity F = new ExcelExportEntity("最终评价等级", "level");
ExcelExportEntity detail = new ExcelExportEntity("三级表头AA", "detail");
detail.setList(Arrays.asList(A, B, E, F));
ExcelExportEntity studentNo = new ExcelExportEntity("学号", "studentNo");
ExcelExportEntity studentName = new ExcelExportEntity("学生", "studentName");
ExcelExportEntity sectionName = new ExcelExportEntity("学段", "sectionName");
ExcelExportEntity gradeName = new ExcelExportEntity("年级", "gradeName");
ExcelExportEntity className = new ExcelExportEntity("班级", "className");
exportList.addAll(CollUtil.newArrayList(studentNo, studentName, sectionName, gradeName, className, detail));
List<Map<String, Object>> list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
Map<String, Object> other = new HashMap<>();
other.put("studentNo", "10086");
other.put("studentName", "小明");
other.put("sectionName", "小学");
other.put("gradeName", "一年级");
other.put("className", "一班");
Map<String, Object> a = new HashMap<>();
Map<String, Object> a1 = new HashMap<>();
a1.put("a1", "指标1");
Map<String, Object> a2 = new HashMap<>();
a2.put("a2", "指标2");
List<Map<String, Object>> aa = CollUtil.newArrayList(a1, a2);
a.put("a", aa);
Map<String, Object> b = new HashMap<>();
Map<String, Object> b1 = new HashMap<>();
b1.put("b1", "指标4");
Map<String, Object> b2 = new HashMap<>();
b2.put("b2", "指标5");
Map<String, Object> b3 = new HashMap<>();
b3.put("b3", "指标6");
List<Map<String, Object>> bb = CollUtil.newArrayList(b1, b2, b3);
b.put("b", bb);
Map<String, Object> sumScore = new HashMap<>();
sumScore.put("sumScore", "98");
Map<String, Object> level = new HashMap<>();
level.put("level", "A");
List<Map<String, Object>> bList = CollUtil.newArrayList(a, b, sumScore, level);
other.put("detail", bList);
list.add(other);
}
// 导出的表格
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), exportList, list);
EasyPoiUtil.downLoadExcelWithFormat("多级动态表头", response, workbook);
是否有同学帮忙解答,我的代码哪里存在问题