public class CellRangeUtil extends Object
CellRangeAddress 工具类CellRangeAddress 表示表格的一个区域,通过定义起始行和列,以及结束行和列,圈定范围,如设置合并单元格等。| Constructor and Description |
|---|
CellRangeUtil() |
| Modifier and Type | Method and Description |
|---|---|
static org.apache.poi.ss.util.CellRangeAddress |
getCellRangeAddress(org.apache.poi.ss.usermodel.Cell cell)
获取合并单元格
CellRangeAddress,如果不是返回null |
static org.apache.poi.ss.util.CellRangeAddress |
getCellRangeAddress(org.apache.poi.ss.usermodel.Sheet sheet,
int x,
int y)
获取合并单元格
CellRangeAddress,如果不是返回null |
static org.apache.poi.ss.util.CellRangeAddress |
getCellRangeAddress(org.apache.poi.ss.usermodel.Sheet sheet,
String locationRef)
获取合并单元格
CellRangeAddress,如果不是返回null |
static org.apache.poi.ss.util.CellRangeAddress |
of(int firstRow,
int lastRow,
int firstCol,
int lastCol)
根据给定的行和列索引创建一个CellRangeAddress对象。
|
static org.apache.poi.ss.util.CellRangeAddress |
of(String ref)
根据字符串表示法创建一个CellRangeAddress对象。
|
static org.apache.poi.ss.util.CellRangeAddress |
ofSingleColumn(int lastRow,
int col)
根据给定的行和列索引创建一个单列CellRangeAddress对象,从首行开始。
|
static org.apache.poi.ss.util.CellRangeAddress |
ofSingleColumn(int firstRow,
int lastRow,
int col)
根据给定的行和列索引创建一个单列CellRangeAddress对象。
|
static org.apache.poi.ss.util.CellRangeAddress |
ofSingleRow(int row,
int lastCol)
根据给定的行和列索引创建一个单行的CellRangeAddress对象,从首列开始。
|
static org.apache.poi.ss.util.CellRangeAddress |
ofSingleRow(int row,
int firstCol,
int lastCol)
根据给定的行和列索引创建一个单行的CellRangeAddress对象。
|
public static org.apache.poi.ss.util.CellRangeAddress of(String ref)
该方法提供了一种通过直接使用字符串引用来创建CellRangeAddress对象的便捷方式。 字符串引用应符合Excel中单元格范围的常规表示法,如"B1" 或 "A1:B2"。
ref - 代表单元格范围的字符串,格式为"A1:B2"。CellRangeAddress.valueOf(String)public static org.apache.poi.ss.util.CellRangeAddress of(int firstRow,
int lastRow,
int firstCol,
int lastCol)
firstRow - 起始行的索引,从0开始计数。lastRow - 结束行的索引,从0开始计数,必须大于firstRow。firstCol - 起始列的索引,从0开始计数。lastCol - 结束列的索引,从0开始计数,必须大于firstCol。public static org.apache.poi.ss.util.CellRangeAddress ofSingleRow(int row,
int lastCol)
row - 行的索引,从0开始计数。lastCol - 结束列的索引,从0开始计数,必须大于firstCol。public static org.apache.poi.ss.util.CellRangeAddress ofSingleRow(int row,
int firstCol,
int lastCol)
row - 行的索引,从0开始计数。firstCol - 起始列的索引,从0开始计数。lastCol - 结束列的索引,从0开始计数,必须大于firstCol。public static org.apache.poi.ss.util.CellRangeAddress ofSingleColumn(int lastRow,
int col)
lastRow - 结束行的索引,从0开始计数,必须大于firstRow。col - 列的索引,从0开始计数。public static org.apache.poi.ss.util.CellRangeAddress ofSingleColumn(int firstRow,
int lastRow,
int col)
firstRow - 起始行的索引,从0开始计数。lastRow - 结束行的索引,从0开始计数,必须大于firstRow。col - 列的索引,从0开始计数。public static org.apache.poi.ss.util.CellRangeAddress getCellRangeAddress(org.apache.poi.ss.usermodel.Sheet sheet,
String locationRef)
CellRangeAddress,如果不是返回nullsheet - SheetlocationRef - 单元格地址标识符,例如A11,B5CellRangeAddresspublic static org.apache.poi.ss.util.CellRangeAddress getCellRangeAddress(org.apache.poi.ss.usermodel.Cell cell)
CellRangeAddress,如果不是返回nullcell - CellCellRangeAddresspublic static org.apache.poi.ss.util.CellRangeAddress getCellRangeAddress(org.apache.poi.ss.usermodel.Sheet sheet,
int x,
int y)
CellRangeAddress,如果不是返回nullsheet - Sheetx - 列号,从0开始y - 行号,从0开始CellRangeAddressCopyright © 2025. All rights reserved.