public class RowUtil extends Object
Row
封装工具类Constructor and Description |
---|
RowUtil() |
Modifier and Type | Method and Description |
---|---|
static org.apache.poi.ss.usermodel.Row |
getOrCreateRow(org.apache.poi.ss.usermodel.Sheet sheet,
int rowIndex)
获取已有行或创建新行
|
static void |
insertRow(org.apache.poi.ss.usermodel.Sheet sheet,
int startRow,
int insertNumber)
插入行
|
static List<Object> |
readRow(org.apache.poi.ss.usermodel.Row row,
CellEditor cellEditor)
读取一行
|
static List<Object> |
readRow(org.apache.poi.ss.usermodel.Row row,
int startCellNumInclude,
int endCellNumInclude,
CellEditor cellEditor)
读取一行
|
static void |
removeRow(org.apache.poi.ss.usermodel.Row row)
从工作表中删除指定的行,此方法修复sheet.shiftRows删除行时会拆分合并的单元格的问题
|
static void |
writeRow(org.apache.poi.ss.usermodel.Row row,
Iterable<?> rowData)
写一行数据,无样式,非标题
|
static void |
writeRow(org.apache.poi.ss.usermodel.Row row,
Iterable<?> rowData,
StyleSet styleSet,
boolean isHeader)
写一行数据
|
public static org.apache.poi.ss.usermodel.Row getOrCreateRow(org.apache.poi.ss.usermodel.Sheet sheet, int rowIndex)
sheet
- Excel表rowIndex
- 行号Row
public static List<Object> readRow(org.apache.poi.ss.usermodel.Row row, CellEditor cellEditor)
row
- 行cellEditor
- 单元格编辑器public static List<Object> readRow(org.apache.poi.ss.usermodel.Row row, int startCellNumInclude, int endCellNumInclude, CellEditor cellEditor)
row
- 行startCellNumInclude
- 起始单元格号,0开始(包含)endCellNumInclude
- 结束单元格号,0开始(包含)cellEditor
- 单元格编辑器public static void writeRow(org.apache.poi.ss.usermodel.Row row, Iterable<?> rowData)
row
- 行rowData
- 一行的数据public static void writeRow(org.apache.poi.ss.usermodel.Row row, Iterable<?> rowData, StyleSet styleSet, boolean isHeader)
row
- 行rowData
- 一行的数据styleSet
- 单元格样式集,包括日期等样式,null表示无样式isHeader
- 是否为标题行public static void insertRow(org.apache.poi.ss.usermodel.Sheet sheet, int startRow, int insertNumber)
sheet
- 工作表startRow
- 插入的起始行insertNumber
- 插入的行数public static void removeRow(org.apache.poi.ss.usermodel.Row row)
row
- 需要删除的行Copyright © 2024. All rights reserved.