public class CellRef extends Object
| Constructor and Description |
|---|
CellRef(int rowIndex,
int colIndex)
Creates a new sheet-free reference based on given row and column indexes.
|
CellRef(String cellRef)
Creates a new reference based on given A1-style string.
|
CellRef(String sheetName,
int rowIndex,
int colIndex)
Creates a new sheet-based reference based on given row and column indexes.
|
CellRef(String sheetName,
int rowIndex,
int colIndex,
boolean isRowAbs,
boolean isColAbs)
Creates a new sheet-based reference.
|
| Modifier and Type | Method and Description |
|---|---|
String |
convertNumToColString(int col)
Takes in a 0-based base-10 column and returns its symbol representation.
|
boolean |
equals(Object o) |
String |
formatAsRowColString()
Formats this cell reference as string in R1C1-style.
|
String |
formatAsRowColString(boolean includeSheetName)
Formats this cell reference as string in R1C1-style.
|
String |
formatAsString()
Formats this cell reference as string in A1-style.
|
String |
formatAsString(boolean includeSheetName)
Formats this cell reference as string in A1-style.
|
int |
getCol()
Gets column index of this cell reference.
|
int |
getRow()
Gets row index of this cell reference.
|
String |
getSheetName()
Gets the name of related sheet.
|
int |
hashCode() |
boolean |
isColAbsolute()
Gets whether column index is absolute.
|
boolean |
isRowAbsolute()
Gets whether row index is absolute.
|
boolean |
isSheetNameDefined()
Checks whether related sheet name is defined for this cell reference (sheet-based or not).
|
void |
setCol(int colIndex)
Sets column index for this cell reference.
|
void |
setColAbsolute(boolean colAbs)
Sets column index as absolute.
|
void |
setRow(int rowIndex)
Sets row index for this cell reference.
|
void |
setRowAbsolute(boolean rowAbs)
Sets row index as absolute.
|
void |
setSheetName(String sheetName)
Sets the name of related sheet and makes this cell reference as sheet-based.
|
String |
toString() |
public CellRef(String cellRef)
cellRef - string representation of the reference in A1-style. E.g. "A3" or "Sheet1!A3"public CellRef(int rowIndex,
int colIndex)
rowIndex - 0-based row index of the reference.colIndex - 0-based column index of the reference.public CellRef(String sheetName, int rowIndex, int colIndex)
sheetName - name of related sheet.rowIndex - 0-based row index of the reference.colIndex - 0-based column index of the reference.public CellRef(String sheetName, int rowIndex, int colIndex, boolean isRowAbs, boolean isColAbs)
sheetName - name of related sheet.rowIndex - 0-based row index of the reference.colIndex - 0-based column index of the reference.isRowAbs - true if row index should be absolute or false otherwise.isColAbs - true if column index should be absolute or false otherwise.public String getSheetName()
null if this cell reference is sheet-free.public void setSheetName(String sheetName)
sheetName - the name of sheet to set.public int getRow()
public void setRow(int rowIndex)
rowIndex - 0-based row index to set.public int getCol()
public void setCol(int colIndex)
colIndex - 0-based column index to set.public boolean isRowAbsolute()
true if row index is absolute or false otherwise.public void setRowAbsolute(boolean rowAbs)
rowAbs - true if row index should be absolute or false otherwise.public boolean isColAbsolute()
true if column index is absolute or false otherwise.public void setColAbsolute(boolean colAbs)
colAbs - true if column index should be absolute or false otherwise.public String formatAsString()
public String formatAsString(boolean includeSheetName)
includeSheetName - set to false if necessary to exclude sheet name in the output string.public String formatAsRowColString()
public String formatAsRowColString(boolean includeSheetName)
includeSheetName - set to false if necessary to exclude sheet name in the output string.public boolean isSheetNameDefined()
true is related sheet name is defined or false otherwise.public String convertNumToColString(int col)
col - 0-based column index to convert.convertNumToColString(3) returns "D"Copyright © 2022. All rights reserved.