From c88a0820350a2151b395308009832b861959f735 Mon Sep 17 00:00:00 2001 From: Jiaju Zhuang Date: Mon, 16 Mar 2020 23:29:43 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=86=99=E4=B8=BB=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=EF=BC=8C=E4=BB=A3=E7=A0=81=E6=9B=B4=E5=8A=A0=E4=BC=98=E9=9B=85?= =?UTF-8?q?=20=E6=B5=8B=E8=AF=95=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/alibaba/excel/context/AnalysisContext.java | 2 +- .../alibaba/excel/write/executor/ExcelWriteAddExecutor.java | 2 +- .../alibaba/excel/write/executor/ExcelWriteFillExecutor.java | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/alibaba/excel/context/AnalysisContext.java b/src/main/java/com/alibaba/excel/context/AnalysisContext.java index 684fb6e0..df17f55d 100644 --- a/src/main/java/com/alibaba/excel/context/AnalysisContext.java +++ b/src/main/java/com/alibaba/excel/context/AnalysisContext.java @@ -88,7 +88,7 @@ public interface AnalysisContext { /** * Data that the customer needs to read * - * @return + * @param readSheetList */ void readSheetList(List readSheetList); diff --git a/src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java b/src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java index 66878c5f..e218fa7d 100644 --- a/src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java +++ b/src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java @@ -37,7 +37,7 @@ public class ExcelWriteAddExecutor extends AbstractExcelWriteExecutor { public void add(List data) { if (CollectionUtils.isEmpty(data)) { - return; + data = new ArrayList(); } WriteSheetHolder writeSheetHolder = writeContext.writeSheetHolder(); int newRowIndex = writeSheetHolder.getNewRowIndexAndStartDoWrite(); diff --git a/src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java b/src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java index 0b8889ad..03607b3d 100644 --- a/src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java +++ b/src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java @@ -84,6 +84,9 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor { } public void fill(Object data, FillConfig fillConfig) { + if (data == null) { + data = new HashMap(16); + } if (fillConfig == null) { fillConfig = FillConfig.builder().build(true); }