20 return $cellAddress ===
null || (!is_array($cellAddress) && trim($cellAddress) ===
'');
45 public static function COLUMN($cellAddress =
null, ?
Cell $pCell =
null)
47 if (self::cellAddressNullOrWhitespace($cellAddress)) {
51 if (is_array($cellAddress)) {
52 foreach ($cellAddress as $columnKey => $value) {
53 $columnKey = preg_replace(
'/[^a-z]/i',
'', $columnKey);
61 $cellAddress = $cellAddress ??
'';
66 [, $cellAddress] = Worksheet::extractSheetTitle($cellAddress,
true);
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)) {
144 if (is_array($cellAddress)) {
145 foreach ($cellAddress as $rowKey => $rowValue) {
146 foreach ($rowValue as $columnKey => $cellValue) {
147 return (
int) preg_replace(
'/\D/',
'', $rowKey);
154 $cellAddress = $cellAddress ??
'';
155 if ($pCell !==
null) {
159 [, $cellAddress] = Worksheet::extractSheetTitle($cellAddress,
true);
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)));
An exception for terminatinating execution or to throw for unit testing.
static getMatrixDimensions(array &$matrix)
Read the dimensions of a matrix, and re-index it with straight numeric keys starting from row 0,...
static extractCellAddresses(string $cellAddress, bool $a1, Worksheet $sheet, string $sheetName='')
static extractWorksheet(string $cellAddress, Cell $pCell)
getColumn()
Get cell coordinate column.
getRow()
Get cell coordinate row.
Helper class to manipulate cell coordinates.
static columnIndexFromString($pString)
Column index from string.