Browse Source

修复有java model漏列时候结果错乱问题

bugfix
jipengfei.jpf 6 years ago
parent
commit
17f0d9e7ed
  1. 2
      pom.xml
  2. 11
      src/main/java/com/alibaba/excel/metadata/ExcelHeadProperty.java
  3. 2
      src/main/java/com/alibaba/excel/read/modelbuild/ModelBuildEventListener.java

2
pom.xml

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>1.0.3</version>
<version>1.0.4-SNAPSHOT</version>
<packaging>jar</packaging>
<name>easyexcel</name>
<description>easyexcel is a excel handle tools written in Java</description>

11
src/main/java/com/alibaba/excel/metadata/ExcelHeadProperty.java

@ -137,6 +137,17 @@ public class ExcelHeadProperty {
return excelColumnProperty;
}
/**
* 根据Excel中的列号获取Excel的表头信息
*
* @param columnNum 列号
* @return ExcelColumnProperty
*/
public ExcelColumnProperty getExcelColumnProperty1(int columnNum) {
return excelColumnPropertyMap1.get(columnNum);
}
/**
* 判断表头是否相同
*

2
src/main/java/com/alibaba/excel/read/modelbuild/ModelBuildEventListener.java

@ -43,7 +43,7 @@ public class ModelBuildEventListener extends AnalysisEventListener {
}
if (excelHeadProperty != null) {
for (int i = 0; i < stringList.size(); i++) {
ExcelColumnProperty columnProperty = excelHeadProperty.getExcelColumnProperty(i);
ExcelColumnProperty columnProperty = excelHeadProperty.getExcelColumnProperty1(i);
if (columnProperty != null) {
Object value = TypeUtil.convert(stringList.get(i), columnProperty.getField(),
columnProperty.getFormat(),context.use1904WindowDate());

Loading…
Cancel
Save