Skip to content

Commit 3f7673f

Browse files
committed
fix 修复 excel模板导出数据被覆盖的问题
1 parent 0b020f5 commit 3f7673f

File tree

1 file changed

+3
-2
lines changed
  • ruoyi-common/ruoyi-common-excel/src/main/java/org/dromara/common/excel/utils

1 file changed

+3
-2
lines changed

ruoyi-common/ruoyi-common-excel/src/main/java/org/dromara/common/excel/utils/ExcelUtil.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,10 @@ public static <T> void exportTemplate(List<T> data, String templatePath, OutputS
245245
.registerWriteHandler(new DataWriteHandler(data.get(0).getClass()))
246246
.build();
247247
WriteSheet writeSheet = EasyExcel.writerSheet().build();
248+
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
248249
// 单表多数据导出 模板格式为 {.属性}
249250
for (T d : data) {
250-
excelWriter.fill(d, writeSheet);
251+
excelWriter.fill(d, fillConfig, writeSheet);
251252
}
252253
excelWriter.finish();
253254
}
@@ -320,7 +321,7 @@ public static void exportTemplateMultiList(Map<String, Object> data, String temp
320321
// 多表导出必须使用 FillWrapper
321322
excelWriter.fill(new FillWrapper(map.getKey(), (Collection<?>) map.getValue()), fillConfig, writeSheet);
322323
} else {
323-
excelWriter.fill(map.getValue(), writeSheet);
324+
excelWriter.fill(map.getValue(), fillConfig, writeSheet);
324325
}
325326
}
326327
excelWriter.finish();

0 commit comments

Comments
 (0)