Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]
(no description)
File Size: | 520 lines (18 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
Coordinate:: (16 methods):
coordinateFromString()
coordinateIsRange()
absoluteReference()
absoluteCoordinate()
splitRange()
buildRange()
rangeBoundaries()
rangeDimension()
getRangeBoundaries()
columnIndexFromString()
stringFromColumnIndex()
extractAllCellReferencesInRange()
getReferencesForCellBlock()
mergeRangesInCollection()
getCellBlocksFromRangeString()
validateRange()
Class: Coordinate - X-Ref
Helper class to manipulate cell coordinates.coordinateFromString($pCoordinateString) X-Ref |
Coordinate from string. param: string $pCoordinateString eg: 'A1' return: string[] Array containing column and row (indexes 0 and 1) |
coordinateIsRange($coord) X-Ref |
Checks if a coordinate represents a range of cells. param: string $coord eg: 'A1' or 'A1:A2' or 'A1:A2,C1:C2' return: bool Whether the coordinate represents a range of cells |
absoluteReference($pCoordinateString) X-Ref |
Make string row, column or cell coordinate absolute. param: string $pCoordinateString e.g. 'A' or '1' or 'A1' return: string Absolute coordinate e.g. '$A' or '$1' or '$A$1' |
absoluteCoordinate($pCoordinateString) X-Ref |
Make string coordinate absolute. param: string $pCoordinateString e.g. 'A1' return: string Absolute coordinate e.g. '$A$1' |
splitRange($pRange) X-Ref |
Split range into coordinate strings. param: string $pRange e.g. 'B4:D9' or 'B4:D9,H2:O11' or 'B4' return: array Array containing one or more arrays containing one or two coordinate strings |
buildRange(array $pRange) X-Ref |
Build range from coordinate strings. param: array $pRange Array containg one or more arrays containing one or two coordinate strings return: string String representation of $pRange |
rangeBoundaries($pRange) X-Ref |
Calculate range boundaries. param: string $pRange Cell range (e.g. A1:A1) return: array Range coordinates [Start Cell, End Cell] |
rangeDimension($pRange) X-Ref |
Calculate range dimension. param: string $pRange Cell range (e.g. A1:A1) return: array Range dimension (width, height) |
getRangeBoundaries($pRange) X-Ref |
Calculate range boundaries. param: string $pRange Cell range (e.g. A1:A1) return: array Range coordinates [Start Cell, End Cell] |
columnIndexFromString($pString) X-Ref |
Column index from string. param: string $pString eg 'A' return: int Column index (A = 1) |
stringFromColumnIndex($columnIndex) X-Ref |
String from column index. param: int $columnIndex Column index (A = 1) return: string |
extractAllCellReferencesInRange($pRange) X-Ref |
Extract all cell references in range, which may be comprised of multiple cell ranges. param: string $pRange Range (e.g. A1 or A1:C10 or A1:E10 A20:E25) return: array Array containing single cell references |
getReferencesForCellBlock($cellBlock) X-Ref |
Get all cell references for an individual cell block. param: string $cellBlock A cell range e.g. A4:B5 return: array All individual cells in that range |
mergeRangesInCollection(array $pCoordCollection) X-Ref |
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' ] param: array $pCoordCollection associative array mapping coordinates to values return: array associative array mapping coordinate ranges to valuea |
getCellBlocksFromRangeString($pRange) X-Ref |
Get the individual cell blocks from a range string, splitting by space and removing any $ characters. param: string $pRange return: string[] |
validateRange($cellBlock, $startColumnIndex, $endColumnIndex, $currentRow, $endRow) X-Ref |
Check that the given range is valid, i.e. that the start column and row are not greater than the end column and row. param: string $cellBlock The original range, for displaying a meaningful error message param: int $startColumnIndex param: int $endColumnIndex param: int $currentRow param: int $endRow |