Browse Source

修改补充最后一列为空会导致返回list少一个数据的问题

2.1.x
Jiaju Zhuang 5 years ago
parent
commit
ea2669db82
  1. 10
      src/main/java/com/alibaba/excel/read/listener/ModelBuildEventListener.java

10
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(), (String)ConverterUtils.convertToJavaObject(cellData, null, null, currentReadHolder.converterMap(),
currentReadHolder.globalConfiguration(), context.readRowHolder().getRowIndex(), key)); currentReadHolder.globalConfiguration(), context.readRowHolder().getRowIndex(), key));
} }
int headSize = currentReadHolder.excelReadHeadProperty().getHeadMap().size();
while (index < headSize) {
map.put(index, null);
index++;
}
return map; return map;
} else { } else {
// Compatible with the old code the old code returns a list // 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(), (String)ConverterUtils.convertToJavaObject(cellData, null, null, currentReadHolder.converterMap(),
currentReadHolder.globalConfiguration(), context.readRowHolder().getRowIndex(), key)); currentReadHolder.globalConfiguration(), context.readRowHolder().getRowIndex(), key));
} }
int headSize = currentReadHolder.excelReadHeadProperty().getHeadMap().size();
while (index < headSize) {
list.add(null);
index++;
}
return list; return list;
} }
} }

Loading…
Cancel
Save