From ea2669db82153f1ac148db4c4e311b02e574978b Mon Sep 17 00:00:00 2001 From: Jiaju Zhuang Date: Sun, 15 Mar 2020 21:28:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A1=A5=E5=85=85=E6=9C=80?= =?UTF-8?q?=E5=90=8E=E4=B8=80=E5=88=97=E4=B8=BA=E7=A9=BA=E4=BC=9A=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E8=BF=94=E5=9B=9Elist=E5=B0=91=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../excel/read/listener/ModelBuildEventListener.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/alibaba/excel/read/listener/ModelBuildEventListener.java b/src/main/java/com/alibaba/excel/read/listener/ModelBuildEventListener.java index f5594db..78b57e0 100644 --- a/src/main/java/com/alibaba/excel/read/listener/ModelBuildEventListener.java +++ b/src/main/java/com/alibaba/excel/read/listener/ModelBuildEventListener.java @@ -62,6 +62,11 @@ public class ModelBuildEventListener extends AbstractIgnoreExceptionReadListener (String)ConverterUtils.convertToJavaObject(cellData, null, null, currentReadHolder.converterMap(), currentReadHolder.globalConfiguration(), context.readRowHolder().getRowIndex(), key)); } + int headSize = currentReadHolder.excelReadHeadProperty().getHeadMap().size(); + while (index < headSize) { + map.put(index, null); + index++; + } return map; } else { // Compatible with the old code the old code returns a list @@ -82,6 +87,11 @@ public class ModelBuildEventListener extends AbstractIgnoreExceptionReadListener (String)ConverterUtils.convertToJavaObject(cellData, null, null, currentReadHolder.converterMap(), currentReadHolder.globalConfiguration(), context.readRowHolder().getRowIndex(), key)); } + int headSize = currentReadHolder.excelReadHeadProperty().getHeadMap().size(); + while (index < headSize) { + list.add(null); + index++; + } return list; } }