public class ExcelConfig extends Object
Modifier and Type | Field and Description |
---|---|
protected CellEditor |
cellEditor
单元格值处理接口
|
protected Map<String,String> |
headerAlias
标题行别名
|
Constructor and Description |
---|
ExcelConfig() |
Modifier and Type | Method and Description |
---|---|
ExcelConfig |
addHeaderAlias(String header,
String alias)
增加标题别名
|
List<Object> |
aliasHeader(List<Object> headerList)
转换标题别名,如果没有别名则使用原标题,当标题为空时,列号对应的字母便是header
|
Object |
aliasHeader(Object headerObj,
int index)
转换标题别名,如果没有别名则使用原标题,当标题为空时,列号对应的字母便是header
|
ExcelConfig |
clearHeaderAlias()
清空标题别名,key为Map中的key,value为别名
|
CellEditor |
getCellEditor()
获取单元格值处理器
|
Map<String,String> |
getHeaderAlias()
获得标题行的别名Map
|
ExcelConfig |
removeHeaderAlias(String header)
去除标题别名
|
ExcelConfig |
setCellEditor(CellEditor cellEditor)
设置单元格值处理逻辑
当Excel中的值并不能满足我们的读取要求时,通过传入一个编辑接口,可以对单元格值自定义,例如对数字和日期类型值转换为字符串等 |
ExcelConfig |
setHeaderAlias(Map<String,String> headerAlias)
设置标题行的别名Map
|
protected CellEditor cellEditor
public ExcelConfig setHeaderAlias(Map<String,String> headerAlias)
headerAlias
- 别名Mappublic ExcelConfig addHeaderAlias(String header, String alias)
header
- 标题alias
- 别名public ExcelConfig removeHeaderAlias(String header)
header
- 标题public ExcelConfig clearHeaderAlias()
public List<Object> aliasHeader(List<Object> headerList)
headerList
- 原标题列表public Object aliasHeader(Object headerObj, int index)
headerObj
- 原标题index
- 标题所在列号,当标题为空时,列号对应的字母便是headerpublic CellEditor getCellEditor()
public ExcelConfig setCellEditor(CellEditor cellEditor)
cellEditor
- 单元格值处理接口Copyright © 2025. All rights reserved.