建议先去看文档
触发场景描述
excel模板如下图:
填充后的结果如下图:图片没有自动往下平移
excel图片设置如下:
触发Bug的代码
try (ExcelWriter excelWriter = EasyExcel.write(outExcelFile)
.withTemplate(templateFile)
.registerConverter(new TimestampStringConverter())
.registerWriteHandler(new ExcelColumnMergeStrategy())
.registerWriteHandler(new ExcelRow2MergeStrategy(datamap))
.build()) {
WriteSheet writeSheet = EasyExcel.writerSheet().build();
for (RXPrintDataSet dataSet : dataSets) {
List<Map<String, Object>> result = datamap.get(dataSet.getName()); //convertData(list, dataSet);
if (dataSet.getObjectType().equals(FRConstants.PRINT_DATASET_ROW)) {
FillConfig rowConfig = FillConfig.builder().direction(WriteDirectionEnum.VERTICAL).forceNewRow(Boolean.TRUE).build();
excelWriter.fill(new FillWrapper(dataSet.getName(), result), rowConfig, writeSheet);
} else if (dataSet.getObjectType().equals(FRConstants.PRINT_DATASET_COLUMN)) {
FillConfig columnConfig = FillConfig.builder().direction(WriteDirectionEnum.HORIZONTAL).forceNewRow(Boolean.TRUE).build();
excelWriter.fill(new FillWrapper(dataSet.getName(), result), columnConfig, writeSheet);
} else if (dataSet.getObjectType().equals(FRConstants.PRINT_DATASET_OBJECT)) {
if (!CollectionUtils.isEmpty(result)) {
Map<String, Object> objectMap = result.get(0);
Map<String, Object> data = new HashMap<>();
for (Map.Entry<String, Object> entry : objectMap.entrySet()) {
data.put(dataSet.getName() + "_" + entry.getKey(), entry.getValue());
}
excelWriter.fill(data, writeSheet);
}
} else {
throw new RuntimeException("数据集对象类型定义错误");
}
}
3条答案
按热度按时间rqqzpn5f1#
有没有人指导下怎么处理
flmtquvp2#
@zhuangjiaju@youlingdada
xxe27gdn3#
请问下该问题解决了吗?有什么处理方式没有