See Release Notes
Long Term Support Release
Differences Between: [Versions 400 and 401] [Versions 401 and 402] [Versions 401 and 403]
1 <?php 2 3 namespace PhpOffice\PhpSpreadsheet\Calculation\LookupRef; 4 5 use PhpOffice\PhpSpreadsheet\Calculation\Calculation; 6 use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError; 7 use PhpOffice\PhpSpreadsheet\Cell\Cell; 8 9 class Formula 10 { 11 /** 12 * FORMULATEXT. 13 * 14 * @param mixed $cellReference The cell to check 15 * @param Cell $cell The current cell (containing this formula) 16 * 17 * @return string 18 */ 19 public static function text($cellReference = '', ?Cell $cell = null) 20 { 21 if ($cell === null) { 22 return ExcelError::REF(); 23 } 24 25 preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellReference, $matches); 26 27 $cellReference = $matches[6] . $matches[7]; 28 $worksheetName = trim($matches[3], "'"); 29 $worksheet = (!empty($worksheetName)) 30 ? $cell->getWorksheet()->getParent()->getSheetByName($worksheetName) 31 : $cell->getWorksheet(); 32 33 if ( 34 $worksheet === null || 35 !$worksheet->cellExists($cellReference) || 36 !$worksheet->getCell($cellReference)->isFormula() 37 ) { 38 return ExcelError::NA(); 39 } 40 41 return $worksheet->getCell($cellReference)->getValue(); 42 } 43 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body