Browse Source

Merge remote-tracking branch 'remotes/origin/master' into 2.1.0-beta1

developing
Jiaju Zhuang 5 years ago
parent
commit
5c89856804
  1. 2
      README.md
  2. 8
      src/main/java/com/alibaba/excel/metadata/property/ExcelHeadProperty.java
  3. 2
      src/test/java/com/alibaba/easyexcel/test/demo/write/ComplexHeadData.java
  4. 2
      src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java

2
README.md

@ -21,7 +21,7 @@ Java解析、生成Excel比较有名的框架有Apache poi、jxl。但他们都
* [更新记事](/update.md) * [更新记事](/update.md)
## 维护者 ## 维护者
姬朋飞(玉霄) 玉霄、庄家钜、怀宇
## 快速开始 ## 快速开始
### 读Excel ### 读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) 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)

8
src/main/java/com/alibaba/excel/metadata/property/ExcelHeadProperty.java

@ -129,6 +129,14 @@ public class ExcelHeadProperty {
Map<Integer, Field> customFiledMap = new TreeMap<Integer, Field>(); Map<Integer, Field> customFiledMap = new TreeMap<Integer, Field>();
for (Field field : fieldList) { for (Field field : fieldList) {
ExcelIgnore excelIgnore = field.getAnnotation(ExcelIgnore.class); 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) { if (excelIgnore != null) {
ignoreMap.put(field.getName(), field); ignoreMap.put(field.getName(), field);
continue; continue;

2
src/test/java/com/alibaba/easyexcel/test/demo/write/ComplexHeadData.java

@ -13,6 +13,8 @@ import lombok.Data;
**/ **/
@Data @Data
public class ComplexHeadData { public class ComplexHeadData {
private final static String TITLE = "title";
private transient String trans = "transient";
@ExcelProperty({"主标题", "字符串标题"}) @ExcelProperty({"主标题", "字符串标题"})
private String string; private String string;
@ExcelProperty({"主标题", "日期标题"}) @ExcelProperty({"主标题", "日期标题"})

2
src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java

@ -85,7 +85,7 @@ public class WriteTest {
* <p> * <p>
* 2. 使用{@link ExcelProperty}注解指定复杂的头 * 2. 使用{@link ExcelProperty}注解指定复杂的头
* <p> * <p>
* 3. 直接写即可 * 3. 直接写即可,写入时会忽略static final和 transient
*/ */
@Test @Test
public void complexHeadWrite() { public void complexHeadWrite() {

Loading…
Cancel
Save