16 private static function convertR1C1(
string &$cellAddress1, ?
string &$cellAddress2,
bool $a1): string
18 if ($a1 === self::CELLADDRESS_USE_R1C1) {
19 $cellAddress1 = AddressHelper::convertToA1($cellAddress1);
21 $cellAddress2 = AddressHelper::convertToA1($cellAddress2);
25 return $cellAddress1 . ($cellAddress2 ?
":$cellAddress2" :
'');
32 if (stripos($value ??
'', $sheetTitle) === 0) {
40 $cellAddress1 = $cellAddress;
43 if ($namedRange !== null) {
44 $workSheet = $namedRange->getWorkSheet();
45 $sheetTitle = ($workSheet === null) ?
'' : $workSheet->getTitle();
46 $value = preg_replace(
'/^=/',
'', $namedRange->getValue());
47 self::adjustSheetTitle($sheetTitle, $value);
48 $cellAddress1 = $sheetTitle . $value;
49 $cellAddress = $cellAddress1;
50 $a1 = self::CELLADDRESS_USE_A1;
52 if (strpos($cellAddress,
':') !==
false) {
53 [$cellAddress1, $cellAddress2] = explode(
':', $cellAddress);
55 $cellAddress = self::convertR1C1($cellAddress1, $cellAddress2, $a1);
57 return [$cellAddress1, $cellAddress2, $cellAddress];
63 if (strpos($cellAddress,
'!') !==
false) {
65 $sheetName = trim($sheetName,
"'");
68 $pSheet = ($sheetName !==
'')
69 ? $pCell->
getWorksheet()->getParent()->getSheetByName($sheetName)
72 return [$cellAddress, $pSheet, $sheetName];
static extractCellAddresses(string $cellAddress, bool $a1, Worksheet $sheet, string $sheetName='')
static extractSheetTitle($pRange, $returnRange=false)
Extract worksheet title from range.
static convertR1C1(string &$cellAddress1, ?string &$cellAddress2, bool $a1)
static adjustSheetTitle(string &$sheetTitle, ?string $value)
static resolveName(string $pDefinedName, Worksheet $pSheet, string $sheetName='')
Resolve a named range to a regular cell range or formula.
const CELLADDRESS_USE_R1C1
getWorksheet()
Get parent worksheet.
static extractWorksheet(string $cellAddress, Cell $pCell)