DEFAULT_RANGE
DEFAULT_RANGE = 'A1:A1' : string
Default range variable constant.
Helper class to manipulate cell coordinates.
Columns indexes and rows are always based on 1, not on 0. This match the behavior
that Excel users are used to, and also match the Excel functions COLUMN()
and ROW()
.
absoluteReference(string $pCoordinateString) : string
Make string row, column or cell coordinate absolute.
string | $pCoordinateString | e.g. 'A' or '1' or 'A1' Note that this value can be a row or column reference as well as a cell reference |
Absolute coordinate e.g. '$A' or '$1' or '$A$1'
splitRange(string $pRange) : array
Split range into coordinate strings.
string | $pRange | e.g. 'B4:D9' or 'B4:D9,H2:O11' or 'B4' |
Array containing one or more arrays containing one or two coordinate strings e.g. ['B4','D9'] or [['B4','D9'], ['H2','O11']] or ['B4']
extractAllCellReferencesInRange(string $cellRange) : array
Extract all cell references in range, which may be comprised of multiple cell ranges.
string | $cellRange | Range: e.g. 'A1' or 'A1:C10' or 'A1:E10,A20:E25' or 'A1:E5 C3:G7' or 'A1:C1,A3:C3 B1:C3' |
Array containing single cell references
mergeRangesInCollection(array $pCoordCollection) : array
Convert an associative array of single cell coordinates to values to an associative array of cell ranges to values. Only adjacent cell coordinates with the same value will be merged. If the value is an object, it must implement the method getHashCode().
For example, this function converts:
[ 'A1' => 'x', 'A2' => 'x', 'A3' => 'x', 'A4' => 'y' ]
to:
[ 'A1:A3' => 'x', 'A4' => 'y' ]
array | $pCoordCollection | associative array mapping coordinates to values |
associative array mapping coordinate ranges to valuea
validateRange(string $cellBlock, int $startColumnIndex, int $endColumnIndex, int $currentRow, int $endRow) : void
Check that the given range is valid, i.e. that the start column and row are not greater than the end column and row.
string | $cellBlock | The original range, for displaying a meaningful error message |
int | $startColumnIndex | |
int | $endColumnIndex | |
int | $currentRow | |
int | $endRow |