diff --git a/pom.xml b/pom.xml index d7adca1f..e004b369 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.alibaba easyexcel - 1.0.3 + 1.0.4-SNAPSHOT jar easyexcel easyexcel is a excel handle tools written in Java diff --git a/src/main/java/com/alibaba/excel/metadata/ExcelHeadProperty.java b/src/main/java/com/alibaba/excel/metadata/ExcelHeadProperty.java index c2ef3d8c..9a8508ec 100644 --- a/src/main/java/com/alibaba/excel/metadata/ExcelHeadProperty.java +++ b/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); + + } + /** * 判断表头是否相同 * diff --git a/src/main/java/com/alibaba/excel/read/modelbuild/ModelBuildEventListener.java b/src/main/java/com/alibaba/excel/read/modelbuild/ModelBuildEventListener.java index c80d8b83..3a4b8dc9 100644 --- a/src/main/java/com/alibaba/excel/read/modelbuild/ModelBuildEventListener.java +++ b/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());