20 return $cellAddress === null || (!is_array($cellAddress) && trim($cellAddress) ===
'');
45 public static function COLUMN($cellAddress = null, ?
Cell $pCell = null)
47 if (self::cellAddressNullOrWhitespace($cellAddress)) {
48 return self::cellColumn($pCell);
51 if (is_array($cellAddress)) {
52 foreach ($cellAddress as $columnKey => $value) {
53 $columnKey = preg_replace(
'/[^a-z]/i',
'', $columnKey);
58 return self::cellColumn($pCell);
61 $cellAddress = $cellAddress ??
'';
67 if (strpos($cellAddress,
':') !==
false) {
68 [$startAddress, $endAddress] = explode(
':', $cellAddress);
69 $startAddress = preg_replace(
'/[^a-z]/i',
'', $startAddress);
70 $endAddress = preg_replace(
'/[^a-z]/i',
'', $endAddress);
78 $cellAddress = preg_replace(
'/[^a-z]/i',
'', $cellAddress);
96 public static function COLUMNS($cellAddress = null)
98 if (self::cellAddressNullOrWhitespace($cellAddress)) {
101 if (!is_array($cellAddress)) {
106 $isMatrix = (is_numeric(key($cellAddress)));
118 return ($pCell !== null) ? $pCell->
getRow() : 1;
138 public static function ROW($cellAddress = null, ?
Cell $pCell = null)
140 if (self::cellAddressNullOrWhitespace($cellAddress)) {
141 return self::cellRow($pCell);
144 if (is_array($cellAddress)) {
145 foreach ($cellAddress as $rowKey => $rowValue) {
146 foreach ($rowValue as $columnKey => $cellValue) {
147 return (
int) preg_replace(
'/\D/',
'', $rowKey);
151 return self::cellRow($pCell);
154 $cellAddress = $cellAddress ??
'';
155 if ($pCell !== null) {
160 if (strpos($cellAddress,
':') !==
false) {
161 [$startAddress, $endAddress] = explode(
':', $cellAddress);
162 $startAddress = preg_replace(
'/\D/',
'', $startAddress);
163 $endAddress = preg_replace(
'/\D/',
'', $endAddress);
169 range($startAddress, $endAddress)
172 [$cellAddress] = explode(
':', $cellAddress);
174 return (
int) preg_replace(
'/\D/',
'', $cellAddress);
190 public static function ROWS($cellAddress = null)
192 if (self::cellAddressNullOrWhitespace($cellAddress)) {
195 if (!is_array($cellAddress)) {
200 $isMatrix = (is_numeric(key($cellAddress)));
static extractCellAddresses(string $cellAddress, bool $a1, Worksheet $sheet, string $sheetName='')
static extractSheetTitle($pRange, $returnRange=false)
Extract worksheet title from range.
getRow()
Get cell coordinate row.
static getMatrixDimensions(array &$matrix)
Read the dimensions of a matrix, and re-index it with straight numeric keys starting from row 0...
static columnIndexFromString($pString)
Column index from string.
static extractWorksheet(string $cellAddress, Cell $pCell)
getColumn()
Get cell coordinate column.