T
- 读取类型public abstract class AbstractSheetReader<T> extends Object implements SheetReader<T>
Sheet
数据读取实现Modifier and Type | Field and Description |
---|---|
protected CellEditor |
cellEditor
单元格值处理接口
|
protected int |
endRowIndex
读取结束行(包含,从0开始计数)
|
protected boolean |
ignoreEmptyRow
是否忽略空行
|
protected int |
startRowIndex
读取起始行(包含,从0开始计数)
|
Constructor and Description |
---|
AbstractSheetReader(int startRowIndex,
int endRowIndex)
构造
|
Modifier and Type | Method and Description |
---|---|
void |
addHeaderAlias(String header,
String alias)
增加标题别名
|
protected List<String> |
aliasHeader(List<Object> headerList)
转换标题别名,如果没有别名则使用原标题,当标题为空时,列号对应的字母便是header
|
protected String |
aliasHeader(Object headerObj,
int index)
转换标题别名,如果没有别名则使用原标题,当标题为空时,列号对应的字母便是header
|
protected List<Object> |
readRow(org.apache.poi.ss.usermodel.Sheet sheet,
int rowIndex)
读取某一行数据
|
void |
setCellEditor(CellEditor cellEditor)
设置单元格值处理逻辑
当Excel中的值并不能满足我们的读取要求时,通过传入一个编辑接口,可以对单元格值自定义,例如对数字和日期类型值转换为字符串等 |
void |
setHeaderAlias(Map<String,String> headerAlias)
设置标题行的别名Map
|
void |
setIgnoreEmptyRow(boolean ignoreEmptyRow)
设置是否忽略空行
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
read
protected final int startRowIndex
protected final int endRowIndex
protected boolean ignoreEmptyRow
protected CellEditor cellEditor
public AbstractSheetReader(int startRowIndex, int endRowIndex)
startRowIndex
- 起始行(包含,从0开始计数)endRowIndex
- 结束行(包含,从0开始计数)public void setCellEditor(CellEditor cellEditor)
cellEditor
- 单元格值处理接口public void setIgnoreEmptyRow(boolean ignoreEmptyRow)
ignoreEmptyRow
- 是否忽略空行public void setHeaderAlias(Map<String,String> headerAlias)
headerAlias
- 别名Mappublic void addHeaderAlias(String header, String alias)
header
- 标题alias
- 别名protected List<String> aliasHeader(List<Object> headerList)
headerList
- 原标题列表protected String aliasHeader(Object headerObj, int index)
headerObj
- 原标题index
- 标题所在列号,当标题为空时,列号对应的字母便是headerCopyright © 2024. All rights reserved.