public class CellAddress extends java.lang.Object implements java.lang.Comparable<CellAddress>
This class is a container for POI usermodel row=0 column=0 cell references. It is barely a container for these two coordinates. The implementation of the Comparable interface sorts by "natural" order top left to bottom right.
Use CellAddress when you want to refer to the location of a cell in a sheet when the concept of relative/absolute does not apply (such as the anchor location of a cell comment). Use CellReference
when the concept of relative/absolute does apply (such as a cell reference in a formula). CellAddresses do not have a concept of "sheet", while CellReferences do.
Modifier and Type | Field and Description |
---|---|
static CellAddress |
A1
A constant for references to the first cell in a sheet.
(用于引用工作表中第一个单元格的常量。)
|
Constructor and Description |
---|
CellAddress(Cell cell)
Create a new CellAddress object.
|
CellAddress(CellAddress address)
Create a new CellAddress object
|
CellAddress(CellReference reference)
Create a new CellAddress object.
|
CellAddress(int row, int column)
Create a new CellAddress object.
|
CellAddress(java.lang.String address)
Create a new CellAddress object.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(CellAddress other)
Compare this CellAddress using the "natural" row-major, column-minor ordering.
(使用“自然”行主要、列次要排序比较此 CellAddress。)
|
boolean |
equals(java.lang.Object o) |
java.lang.String |
formatAsString()
Same as
toString()
(与 toString() 相同)
|
int |
getColumn()
Get the cell address column
(获取单元格地址栏)
|
int |
getRow()
Get the cell address row
(获取单元格地址行)
|
int |
hashCode() |
java.lang.String |
toString() |
public static final CellAddress A1
public CellAddress(int row, int column)
row
- Row index (first row is 0)
(row - 行索引(第一行为 0))
column
- Column index (first column is 0)
(column - 列索引(第一列为 0))
public CellAddress(java.lang.String address)
address
- a cell address in A1 format. Address may not contain sheet name or dollar signs. (that is, address is not a cell reference. Use
CellAddress(CellReference)
instead if starting with a cell reference.)
(地址 - A1 格式的单元格地址。地址不得包含工作表名称或美元符号。 (也就是说,地址不是单元格引用。如果以单元格引用开头,请改用 CellAddress(CellReference)。))
public CellAddress(CellReference reference)
reference
- a reference to a cell
(reference - 对单元格的引用)
public CellAddress(CellAddress address)
address
- a CellAddress
(地址 - 一个 CellAddress)
public CellAddress(Cell cell)
cell
- the Cell to get the location of
(cell - 要获取位置的 Cell)
public int getRow()
public int getColumn()
public int compareTo(CellAddress other)
compareTo
in interface
java.lang.Comparable<CellAddress>
(接口 java.lang.Comparable 中的 compareTo
other
-
(其他 -)
public boolean equals(java.lang.Object o)
equals
in class
java.lang.Object
public int hashCode()
hashCode
in class
java.lang.Object
public java.lang.String toString()
toString
in class
java.lang.Object
public java.lang.String formatAsString()
toString()
(与 toString() 相同)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.