fix 修复 excel模板导出数据被覆盖的问题
This commit is contained in:
parent
c2f67b4a77
commit
26abb98747
@ -245,9 +245,10 @@ public class ExcelUtil {
|
|||||||
.registerWriteHandler(new DataWriteHandler(data.get(0).getClass()))
|
.registerWriteHandler(new DataWriteHandler(data.get(0).getClass()))
|
||||||
.build();
|
.build();
|
||||||
WriteSheet writeSheet = EasyExcel.writerSheet().build();
|
WriteSheet writeSheet = EasyExcel.writerSheet().build();
|
||||||
|
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
|
||||||
// 单表多数据导出 模板格式为 {.属性}
|
// 单表多数据导出 模板格式为 {.属性}
|
||||||
for (T d : data) {
|
for (T d : data) {
|
||||||
excelWriter.fill(d, writeSheet);
|
excelWriter.fill(d, fillConfig, writeSheet);
|
||||||
}
|
}
|
||||||
excelWriter.finish();
|
excelWriter.finish();
|
||||||
}
|
}
|
||||||
@ -320,7 +321,7 @@ public class ExcelUtil {
|
|||||||
// 多表导出必须使用 FillWrapper
|
// 多表导出必须使用 FillWrapper
|
||||||
excelWriter.fill(new FillWrapper(map.getKey(), (Collection<?>) map.getValue()), fillConfig, writeSheet);
|
excelWriter.fill(new FillWrapper(map.getKey(), (Collection<?>) map.getValue()), fillConfig, writeSheet);
|
||||||
} else {
|
} else {
|
||||||
excelWriter.fill(map.getValue(), writeSheet);
|
excelWriter.fill(map.getValue(), fillConfig, writeSheet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
excelWriter.finish();
|
excelWriter.finish();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user