public class PositionUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
ALPHABET_SIZE
a..z: 26 letters
|
static int |
ORD_A
the base for computing
|
| Constructor and Description |
|---|
PositionUtil(TableNameUtil tableNameUtil)
Create a new position util
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkTableName(CharSequence name)
Check if the table name is ok.
|
static PositionUtil |
create() |
CellRef |
newCellRef(int row,
int col) |
CellRef |
newCellRef(String address)
Convert a cell position string like B3 to the column number.
|
CellRef |
newCellRef(Table table,
int row,
int col) |
String |
toCellAddress(int row,
int col)
Return the Excel/OO/LO address of a cell
|
String |
toCellAddress(Table table,
int row,
int col)
the Excel/OO/LO address of a cell, preceded by the table name
|
String |
toRangeAddress(int row1,
int col1,
int row2,
int col2)
Return the Excel/OO/LO address of a range
|
String |
toRangeAddress(Table table,
int row1,
int col1,
int row2,
int col2)
Return the Excel/OO/LO address of a range, preceded by the table name
|
public static final int ALPHABET_SIZE
public static final int ORD_A
public PositionUtil(TableNameUtil tableNameUtil)
tableNameUtil - an util to check table namespublic static PositionUtil create()
public CellRef newCellRef(String address) throws ParseException, IOException
address - The cell position in the range 'A1' to 'IV65536'ParseException - If the address can't be parsed.IOException - neverpublic CellRef newCellRef(int row, int col)
row - the rowcol - the colpublic CellRef newCellRef(Table table, int row, int col)
table - the tablerow - the rowcol - the colpublic String toCellAddress(int row, int col)
row - the rowcol - the colpublic String toCellAddress(Table table, int row, int col)
row - the rowcol - the coltable - the tablepublic String toRangeAddress(int row1, int col1, int row2, int col2)
row1 - the first rowcol1 - the first colrow2 - the last rowcol2 - the last colpublic String toRangeAddress(Table table, int row1, int col1, int row2, int col2)
row1 - the first rowcol1 - the first colrow2 - the last rowcol2 - the last coltable - the tablepublic void checkTableName(CharSequence name)
name - the name to checkIllegalArgumentException - if the table name is not accepted.Copyright © 2016–2021. All rights reserved.