| 程序包 | 说明 |
|---|---|
| org.dromara.hutool.poi.excel |
POI中对Excel读写的封装,入口为ExcelUtil
|
| org.dromara.hutool.poi.excel.cell |
Excel中单元格相关类,入口为CellUtil
|
| org.dromara.hutool.poi.excel.cell.editors |
单元格值编辑器,内部使用
|
| org.dromara.hutool.poi.excel.cell.values |
不同类型单元格值的封装
|
| org.dromara.hutool.poi.excel.reader |
数据读取接口及实现,此包中定义了SheetReader,通过实现此接口,实现sheet中的数据读取为不同类型。
|
| 限定符和类型 | 方法和说明 |
|---|---|
static List<Object> |
RowUtil.readRow(org.apache.poi.ss.usermodel.Row row,
CellEditor cellEditor)
读取一行
|
static List<Object> |
RowUtil.readRow(org.apache.poi.ss.usermodel.Row row,
int startCellNumInclude,
int endCellNumInclude,
CellEditor cellEditor)
读取一行
|
ExcelWriter |
ExcelWriter.setCellEditor(CellEditor cellEditor)
设置单元格值处理逻辑
当Excel中的值并不能满足我们的读取要求时,通过传入一个编辑接口,可以对单元格值自定义,例如对数字和日期类型值转换为字符串等 |
ExcelReader |
ExcelReader.setCellEditor(CellEditor cellEditor)
设置单元格值处理逻辑
当Excel中的值并不能满足我们的读取要求时,通过传入一个编辑接口,可以对单元格值自定义,例如对数字和日期类型值转换为字符串等 |
static void |
RowUtil.writeRow(org.apache.poi.ss.usermodel.Row row,
Iterable<?> rowData,
CellEditor cellEditor)
写一行数据,无样式,非标题
|
static void |
RowUtil.writeRow(org.apache.poi.ss.usermodel.Row row,
Iterable<?> rowData,
StyleSet styleSet,
boolean isHeader,
CellEditor cellEditor)
写一行数据
|
| 限定符和类型 | 方法和说明 |
|---|---|
static Object |
CellUtil.getCellValue(org.apache.poi.ss.usermodel.Cell cell,
CellEditor cellEditor)
获取单元格值
|
static Object |
CellUtil.getCellValue(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellType cellType,
CellEditor cellEditor)
获取单元格值
如果单元格值为数字格式,则判断其格式中是否有小数部分,无则返回Long类型,否则返回Double类型 |
static void |
CellUtil.setCellValue(org.apache.poi.ss.usermodel.Cell cell,
Object value,
CellEditor cellEditor)
设置单元格值
根据传入的styleSet自动匹配样式 当为头部样式时默认赋值头部样式,但是头部中如果有数字、日期等类型,将按照数字、日期样式设置 |
static void |
CellUtil.setCellValue(org.apache.poi.ss.usermodel.Cell cell,
Object value,
org.apache.poi.ss.usermodel.CellStyle style,
CellEditor cellEditor)
设置单元格值
根据传入的styleSet自动匹配样式 当为头部样式时默认赋值头部样式,但是头部中如果有数字、日期等类型,将按照数字、日期样式设置 |
static void |
CellUtil.setCellValue(org.apache.poi.ss.usermodel.Cell cell,
Object value,
StyleSet styleSet,
boolean isHeader,
CellEditor cellEditor)
设置单元格值
根据传入的styleSet自动匹配样式 当为头部样式时默认赋值头部样式,但是头部中如果有数字、日期等类型,将按照数字、日期样式设置 |
| 限定符和类型 | 类和说明 |
|---|---|
class |
NumericToIntEditor
POI中NUMRIC类型的值默认返回的是Double类型,此编辑器用于转换其为int型
|
class |
TrimEditor
去除String类型的单元格值两边的空格
|
| 限定符和类型 | 方法和说明 |
|---|---|
static CompositeCellValue |
CompositeCellValue.of(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellType cellType,
CellEditor cellEditor)
创建CompositeCellValue
|
| 构造器和说明 |
|---|
CompositeCellValue(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellType cellType,
CellEditor cellEditor)
构造
|
| 限定符和类型 | 字段和说明 |
|---|---|
protected CellEditor |
AbstractSheetReader.cellEditor
单元格值处理接口
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
BeanSheetReader.setCellEditor(CellEditor cellEditor)
设置单元格值处理逻辑
当Excel中的值并不能满足我们的读取要求时,通过传入一个编辑接口,可以对单元格值自定义,例如对数字和日期类型值转换为字符串等 |
void |
AbstractSheetReader.setCellEditor(CellEditor cellEditor)
设置单元格值处理逻辑
当Excel中的值并不能满足我们的读取要求时,通过传入一个编辑接口,可以对单元格值自定义,例如对数字和日期类型值转换为字符串等 |
Copyright © 2024. All rights reserved.