Bugfix: Work item 15762 - INDIRECT() function doesn't work with named ranges

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@72460 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2011-04-29 13:44:27 +00:00
parent 5979a4ec13
commit dd7b0610e9
2 changed files with 14 additions and 1 deletions

View File

@ -283,6 +283,8 @@ class PHPExcel_Calculation_LookupRef {
if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) ||
((!is_null($cellAddress2)) && (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress2, $matches)))) {
if (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $cellAddress1, $matches)) {
return PHPExcel_Calculation_Functions::REF();
}
@ -293,6 +295,16 @@ class PHPExcel_Calculation_LookupRef {
$pSheet = $pCell->getParent();
}
return PHPExcel_Calculation::getInstance()->extractNamedRange($cellAddress, $pSheet, False);
}
if (strpos($cellAddress,'!') !== false) {
list($sheetName,$cellAddress) = explode('!',$cellAddress);
$pSheet = $pCell->getParent()->getParent()->getSheetByName($sheetName);
} else {
$pSheet = $pCell->getParent();
}
return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, False);
} // function INDIRECT()

View File

@ -32,6 +32,7 @@ Fixed in SVN:
- Bugfix: (MBaker) Support for Excel functions whose return can be used as either a value or as a cell reference depending on its context within a formula
- Bugfix: (gilles06) Work item 15707 - ini_set() call in Calculation class destructor
- Bugfix: (MBaker) Work item 15786 - RangeToArray strange array keys
- Bugfix: (MBaker) Work item 15762 - INDIRECT() function doesn't work with named ranges
- General: (MBaker) Work item 15405 - Two easy to fix Issues concerning PHPExcel_Token_Stack (l10n/UC)
- General: (MBaker) Work item 15461 - Locale file paths not fit for windows