com.eworkcloud.excel.model.ExcelColumn Maven / Gradle / Ivy
package com.eworkcloud.excel.model;
import com.eworkcloud.excel.annotation.ExcelProperty;
import com.eworkcloud.excel.enmus.ValueType;
import lombok.Getter;
import lombok.Setter;
import java.lang.reflect.Field;
@Getter
public class ExcelColumn implements Comparable {
/**
* 字段
*/
private final Field field;
/**
* 固定索引
*/
@Setter
private int index;
/**
* 列名
*/
private final String name;
/**
* 类型[0:文本|1:图片]
*/
private final ValueType type;
/**
* 列宽[12]
*/
private final int width;
/**
* 数字格式[#.##]
* 时间格式[yyyy-MM-dd HH:mm:ss]
*/
private final String format;
/**
* 文本后缀[%]
*/
private final String suffix;
/**
* 值的替换[a|id,b|id]
*/
private final String[] replace;
/**
* 是否换行[true]
*/
private final boolean wrap;
/**
* 是否隐藏[false]
*/
private final boolean hidden;
/**
* 是否必须[false]
*/
private final boolean required;
public ExcelColumn(Field field, ExcelProperty excel) {
this.field = field;
this.index = excel.index();
this.name = excel.name();
this.type = excel.type();
this.width = excel.width();
this.format = excel.format();
this.suffix = excel.suffix();
this.replace = excel.replace();
this.wrap = excel.isWrap();
this.hidden = excel.isHidden();
this.required = excel.isRequired();
}
@Override
public int compareTo(ExcelColumn entity) {
return index - entity.getIndex();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy