public class CellRefUtil extends Object
Modifier and Type | Field and Description |
---|---|
static char |
ABSOLUTE_REFERENCE_MARKER
The character ($) that signifies a row or column value is absolute instead of relative
|
static char |
SHEET_NAME_DELIMITER
The character (!) that separates sheet names from cell references
|
Constructor and Description |
---|
CellRefUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
appendFormat(StringBuilder out,
String rawSheetName) |
static boolean |
cellReferenceIsWithinRange(String colStr,
String rowStr,
int lastColumnIndex,
int lastRowIndex)
Used to decide whether a name of the form "[A-Z]*[0-9]*" that appears in a formula can be
interpreted as a cell reference.
|
static int |
convertColStringToIndex(String ref)
takes in a column reference portion of a CellRef and converts it from
ALPHA-26 number format to 0-based base 10.
|
static String |
convertNumToColString(int col)
Takes in a 0-based base-10 column and returns a ALPHA-26
representation.
|
static boolean |
isColumnWithnRange(String colStr,
int lastColumnIndex) |
static boolean |
isPlainColumn(String refPart) |
static boolean |
isRowWithnRange(String rowStr,
int lastRowIndex) |
static String |
parseSheetName(String reference,
int indexOfSheetNameDelimiter) |
static String[] |
separateAreaRefs(String reference)
Separates Area refs in two parts and returns them as separate elements in a String array,
each qualified with the sheet name (if present)
|
static String[] |
separateRefParts(String reference) |
public static final char SHEET_NAME_DELIMITER
public static final char ABSOLUTE_REFERENCE_MARKER
public static String convertNumToColString(int col)
public static void appendFormat(StringBuilder out, String rawSheetName)
public static boolean cellReferenceIsWithinRange(String colStr, String rowStr, int lastColumnIndex, int lastRowIndex)
POI currently targets BIFF8 (Excel 97-2003), so the following behaviour can be observed for this method:
Version File Format Last Column Last Row 97-2003 BIFF8 "IV" (2^8) 65536 (2^14) 2007 BIFF12 "XFD" (2^14) 1048576 (2^20)
Input Result "A", "1" true "a", "111" true "A", "65536" true "A", "65537" false "iv", "1" true "IW", "1" false "AAA", "1" false "a", "111" true "Sheet", "1" false
colStr
- a string of only letter charactersrowStr
- a string of only digit characterstrue
if the row and col parameters are within range of a BIFF8 spreadsheet.public static boolean isColumnWithnRange(String colStr, int lastColumnIndex)
public static boolean isRowWithnRange(String rowStr, int lastRowIndex)
public static int convertColStringToIndex(String ref)
public static String[] separateAreaRefs(String reference)
null
public static boolean isPlainColumn(String refPart)
Copyright © 2017. All rights reserved.