String templateFileName = "E:\\xnworkspace\\mgmt-data-analysis\\src\\main\\resources\\template\\mainReportTpl.xlsx";
String fileName = "E:\\xnworkspace\\mgmt-data-analysis\\sdf.xlsx";
MainReportData data = projectService.mainReportData(41);
List<DetailReportData> mainReportData = projectService.detailReportData(41);
DetailReportData.replaceStatusField(mainReportData);
List<OnceAbsoluteMergeStrategy> mergeStrategyList = DetailReportData.getMergeStrategy(mainReportData);
List<HorizontalCellStyleStrategy> styleStrategyList = DetailReportData.getStyleStrategy(mainReportData);
ExcelWriterBuilder write = EasyExcel.write(fileName);
write.withTemplate(templateFileName).sheet().doFill(data);
ExcelWriterSheetBuilder sheet2 = write.head(DetailReportData.class).sheet(1, "任务详情");
for (OnceAbsoluteMergeStrategy onceAbsoluteMergeStrategy : mergeStrategyList) {
sheet2.registerWriteHandler(onceAbsoluteMergeStrategy);
}
for (HorizontalCellStyleStrategy horizontalCellStyleStrategy : styleStrategyList) {
sheet2.registerWriteHandler(horizontalCellStyleStrategy);
}
sheet2.doWrite(mainReportData);
异常提示
建议描述
目前的情况是第一个只要加上了第二个页签的处理,第一个页签的数据就是空的
1条答案
按热度按时间6vl6ewon1#