public class CellPosition extends Object implements Serializable, Comparable<CellPosition>, Cloneable
Pointだと、行、列の表現がわかりづらくmutableなので、、その代わりに使用する。
CellReferenceとの違いは、セルのアドレスの絶対一致を表現するためのもの。
POIに同じ用途のクラスCellAddressが存在するが、
こちらはSerializableやCloneableが実装されておらず、使い勝手が悪い。
| 修飾子とタイプ | フィールドと説明 |
|---|---|
static CellPosition |
A1
シート上の先頭の位置を表現するための定数。
|
| 修飾子とタイプ | メソッドと説明 |
|---|---|
CellPosition |
addColumn(int value)
列番号に指定した値を加算する。
|
CellPosition |
addRow(int value)
行番号に指定した値を加算する。
|
CellPosition |
clone() |
int |
compareTo(CellPosition other) |
boolean |
equals(Object obj) |
String |
formatAsString()
セルのアドレスを取得する。
|
int |
getColumn()
列番号を取得する。
|
int |
getRow()
行番号を取得する。
|
int |
hashCode() |
static CellPosition |
of(org.apache.poi.ss.usermodel.Cell cell)
CellAddressのインスタンスを作成する。
|
static CellPosition |
of(org.apache.poi.ss.util.CellAddress address)
CellAddressのインスタンスを作成する。
|
static CellPosition |
of(org.apache.poi.ss.util.CellReference reference)
CellAddressのインスタンスを作成する。
|
static CellPosition |
of(int row,
int column)
CellAddressのインスタンスを作成する。
|
static CellPosition |
of(Point point)
CellAddressのインスタンスを作成する。
|
static CellPosition |
of(String address)
CellAddressのインスタンスを作成する。
|
org.apache.poi.ss.util.CellAddress |
toCellAddress()
POIの
CellAddressの形式に変換します。 |
Point |
toPoint()
Pointの形式に変換します。 |
String |
toString()
formatAsString()の値を返します。 |
public static final CellPosition A1
public static CellPosition of(int row, int column)
row - 行番号 (0から始まる)column - 列番号 (0から始まる)CellPositionのインスタンスIllegalArgumentException - row < 0 || column < 0public static CellPosition of(org.apache.poi.ss.usermodel.Cell cell)
cell - セルのインスタンス。CellPositionのインスタンスIllegalArgumentException - cell == null.public static CellPosition of(org.apache.poi.ss.util.CellReference reference)
reference - セルの参照形式。CellPositionのインスタンスIllegalArgumentException - reference == null.public static CellPosition of(org.apache.poi.ss.util.CellAddress address)
address - セルのアドレスCellPositionのインスタンスIllegalArgumentException - address == null.public static CellPosition of(String address)
address - 'A1'の形式のセルのアドレスCellPositionのインスタンスIllegalArgumentException - address == null || address.length() == 0 || アドレスの書式として不正public static CellPosition of(Point point)
point - セルの座標CellPositionのインスタンスIllegalArgumentException - point == null.public int compareTo(CellPosition other)
compareTo インタフェース内 Comparable<CellPosition>public CellPosition clone()
public int getRow()
public int getColumn()
public Point toPoint()
Pointの形式に変換します。Pointのインスタンス。
x座標が列番号(column index)、y座標が行番号(row index)なります。public org.apache.poi.ss.util.CellAddress toCellAddress()
CellAddressの形式に変換します。CellAddressのインスタンス。public String formatAsString()
public CellPosition addRow(int value)
value - 加算する値public CellPosition addColumn(int value)
value - 加算する値public String toString()
formatAsString()の値を返します。Copyright © 2025 mygreen. All rights reserved.