Package | Description |
---|---|
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 |
不同类型单元格值的封装
|
Modifier and Type | Field and Description |
---|---|
protected CellEditor |
ExcelConfig.cellEditor
单元格值处理接口
|
Modifier and Type | Method and Description |
---|---|
CellEditor |
ExcelConfig.getCellEditor()
获取单元格值处理器
|
Modifier and Type | Method and Description |
---|---|
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)
读取一行
|
ExcelConfig |
ExcelConfig.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)
写一行数据
|
Modifier and Type | Method and Description |
---|---|
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自动匹配样式 当为头部样式时默认赋值头部样式,但是头部中如果有数字、日期等类型,将按照数字、日期样式设置 |
Modifier and Type | Class and Description |
---|---|
class |
NumericToIntEditor
POI中NUMRIC类型的值默认返回的是Double类型,此编辑器用于转换其为int型
|
class |
TrimEditor
去除String类型的单元格值两边的空格
|
Modifier and Type | Method and Description |
---|---|
static CompositeCellValue |
CompositeCellValue.of(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellType cellType,
CellEditor cellEditor)
创建CompositeCellValue
|
Constructor and Description |
---|
CompositeCellValue(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.CellType cellType,
CellEditor cellEditor)
构造
|
Copyright © 2025. All rights reserved.