触发场景描述
header的List<List
if (response != null) {
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf-8");
String fileName = URLEncoder.encode(getFilename(), "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
EasyExcel.write(response.getOutputStream(), setClass()).head(getHeaders()).sheet().doWrite(list);
}
private List<List<String>> getHeaders() {
List<List<String>> customHeaders = new ArrayList<>();
customHeaders.addAll(setHeaders());
customHeaders.addAll(initHeaders());
for (var list : customHeaders) {
list.add(0, formatHeader());
}
return customHeaders;
}
private List<List<String>> initHeaders() {
List<List<String>> list = new ArrayList<>();
List<String> head0 = new ArrayList<>();
head0.add("待办任务量");
List<String> head1 = new ArrayList<>();
head1.add("待办处理量");
List<String> head2 = new ArrayList<>();
head2.add("待办随行处理量");
List<String> head3 = new ArrayList<>();
head3.add("待办随行处理占比");
List<String> head4 = new ArrayList<>();
head4.add("待阅任务量");
List<String> head5 = new ArrayList<>();
head5.add("待阅处理量");
List<String> head6 = new ArrayList<>();
head6.add("待阅随行处理量");
List<String> head7 = new ArrayList<>();
head7.add("待阅随行处理占比");
list.add(head0);
list.add(head1);
list.add(head2);
list.add(head3);
list.add(head4);
list.add(head5);
list.add(head6);
list.add(head7);
return list;
}
protected List<List<String>> setHeaders() {
return new ArrayList<List<String>>() {{
add(new ArrayList<String>() {{
add("分类名称");
}});
}};
}
提示的异常或者没有达到的效果