diff --git a/README.md b/README.md index 535d1e55..fd5c5a2f 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Java解析、生成Excel比较有名的框架有Apache poi、jxl。但他们都 * [更新记事](/update.md) ## 维护者 -姬朋飞(玉霄) +玉霄、庄家钜、怀宇 ## 快速开始 ### 读Excel DEMO代码地址:[https://github.com/alibaba/easyexcel/blob/master/src/test/java/com/alibaba/easyexcel/demo/read/ReadTest.java](/src/test/java/com/alibaba/easyexcel/test/demo/read/ReadTest.java) @@ -91,4 +91,4 @@ DEMO代码地址:[https://github.com/alibaba/easyexcel/blob/master/src/test/ja ### 联系我们 有问题阿里同事可以通过钉钉找到我,阿里外同学可以通过git留言。其他技术非技术相关的也欢迎一起探讨。 ### 招聘&交流 -阿里巴巴新零售事业部--诚招JAVA资深开发、技术专家。有意向可以微信联系,简历可以发我邮箱jipengfei.jpf@alibaba-inc.com \ No newline at end of file +阿里巴巴新零售事业部--诚招JAVA资深开发、技术专家。有意向可以微信联系,简历可以发我邮箱jipengfei.jpf@alibaba-inc.com diff --git a/src/main/java/com/alibaba/excel/metadata/property/ExcelHeadProperty.java b/src/main/java/com/alibaba/excel/metadata/property/ExcelHeadProperty.java index 69211617..06d94bb0 100644 --- a/src/main/java/com/alibaba/excel/metadata/property/ExcelHeadProperty.java +++ b/src/main/java/com/alibaba/excel/metadata/property/ExcelHeadProperty.java @@ -129,6 +129,14 @@ public class ExcelHeadProperty { Map customFiledMap = new TreeMap(); for (Field field : fieldList) { ExcelIgnore excelIgnore = field.getAnnotation(ExcelIgnore.class); + if(Modifier.isStatic(field.getModifiers())&&Modifier.isFinal(field.getModifiers())){ + ignoreMap.put(field.getName(),field); + continue; + } + if(Modifier.isTransient(field.getModifiers())){ + ignoreMap.put(field.getName(),field); + continue; + } if (excelIgnore != null) { ignoreMap.put(field.getName(), field); continue; diff --git a/src/test/java/com/alibaba/easyexcel/test/demo/write/ComplexHeadData.java b/src/test/java/com/alibaba/easyexcel/test/demo/write/ComplexHeadData.java index 44ce5cc7..4c5d0c6b 100644 --- a/src/test/java/com/alibaba/easyexcel/test/demo/write/ComplexHeadData.java +++ b/src/test/java/com/alibaba/easyexcel/test/demo/write/ComplexHeadData.java @@ -13,6 +13,8 @@ import lombok.Data; **/ @Data public class ComplexHeadData { + private final static String TITLE = "title"; + private transient String trans = "transient"; @ExcelProperty({"主标题", "字符串标题"}) private String string; @ExcelProperty({"主标题", "日期标题"}) diff --git a/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java b/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java index 2582f105..0da187f0 100644 --- a/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java +++ b/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java @@ -85,7 +85,7 @@ public class WriteTest { *

* 2. 使用{@link ExcelProperty}注解指定复杂的头 *

- * 3. 直接写即可 + * 3. 直接写即可,写入时会忽略static final和 transient */ @Test public void complexHeadWrite() {