Package org.aoju.bus.office.excel
Class RowKit
java.lang.Object
org.aoju.bus.office.excel.RowKit
Excel中的行
Row封装工具类- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.poi.ss.usermodel.RowgetOrCreateRow(org.apache.poi.ss.usermodel.Sheet sheet, int rowIndex) 获取已有行或创建新行static voidinsertRow(org.apache.poi.ss.usermodel.Sheet sheet, int startRow, int insertNumber) 插入行readRow(org.apache.poi.ss.usermodel.Row row, int startCellNumInclude, int endCellNumInclude, CellEditor cellEditor) 读取一行readRow(org.apache.poi.ss.usermodel.Row row, CellEditor cellEditor) 读取一行static voidremoveRow(org.apache.poi.ss.usermodel.Row row) 从工作表中删除指定的行,此方法修复sheet.shiftRows删除行时会拆分合并的单元格的问题static voidwriteRow(org.apache.poi.ss.usermodel.Row row, Iterable<?> rowData, CellEditor cellEditor) 写一行数据,无样式,非标题static voidwriteRow(org.apache.poi.ss.usermodel.Row row, Iterable<?> rowData, StyleSet styleSet, boolean isHeader, CellEditor cellEditor) 写一行数据
-
Constructor Details
-
RowKit
public RowKit()
-
-
Method Details
-
getOrCreateRow
public static org.apache.poi.ss.usermodel.Row getOrCreateRow(org.apache.poi.ss.usermodel.Sheet sheet, int rowIndex) 获取已有行或创建新行- Parameters:
sheet- Excel表rowIndex- 行号- Returns:
Row
-
readRow
读取一行- Parameters:
row- 行cellEditor- 单元格编辑器- Returns:
- 单元格值列表
-
readRow
public static List<Object> readRow(org.apache.poi.ss.usermodel.Row row, int startCellNumInclude, int endCellNumInclude, CellEditor cellEditor) 读取一行- Parameters:
row- 行startCellNumInclude- 起始单元格号,0开始(包含)endCellNumInclude- 结束单元格号,0开始(包含)cellEditor- 单元格编辑器- Returns:
- 单元格值列表
-
writeRow
public static void writeRow(org.apache.poi.ss.usermodel.Row row, Iterable<?> rowData, CellEditor cellEditor) 写一行数据,无样式,非标题- Parameters:
row- 行rowData- 一行的数据cellEditor- 单元格值编辑器,可修改单元格值或修改单元格,null表示不编辑
-
writeRow
public static void writeRow(org.apache.poi.ss.usermodel.Row row, Iterable<?> rowData, StyleSet styleSet, boolean isHeader, CellEditor cellEditor) 写一行数据- Parameters:
row- 行rowData- 一行的数据styleSet- 单元格样式集,包括日期等样式,null表示无样式isHeader- 是否为标题行cellEditor- 单元格值编辑器,可修改单元格值或修改单元格,null表示不编辑
-
insertRow
public static void insertRow(org.apache.poi.ss.usermodel.Sheet sheet, int startRow, int insertNumber) 插入行- Parameters:
sheet- 工作表startRow- 插入的起始行insertNumber- 插入的行数
-
removeRow
public static void removeRow(org.apache.poi.ss.usermodel.Row row) 从工作表中删除指定的行,此方法修复sheet.shiftRows删除行时会拆分合并的单元格的问题- Parameters:
row- 需要删除的行
-