Bugfix: 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

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@71420 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2011-04-05 21:57:59 +00:00
parent 2d362092ba
commit 70f773f0ca
2 changed files with 19 additions and 1 deletions

View File

@ -3001,14 +3001,31 @@ class PHPExcel_Calculation {
// We must have two operands, error if we don't
if (is_null($operand2Data = $stack->pop())) return $this->_raiseFormulaError('Internal error - Operand value missing from stack');
if (is_null($operand1Data = $stack->pop())) return $this->_raiseFormulaError('Internal error - Operand value missing from stack');
// Log what we're doing
$operand1 = $operand1Data['value'];
if ((is_null($operand1Data['reference'])) && (is_array($operand1))) {
$rowKey = array_shift(array_keys($operand1));
$colKey = array_shift(array_keys($operand1[$rowKey]));
if (ctype_upper($colKey)) {
$operand1Data['reference'] = $colKey.$rowKey;
}
}
$operand2 = $operand2Data['value'];
if ((is_null($operand2Data['reference'])) && (is_array($operand2))) {
$rowKey = array_shift(array_keys($operand2));
$colKey = array_shift(array_keys($operand2[$rowKey]));
if (ctype_upper($colKey)) {
$operand2Data['reference'] = $colKey.$rowKey;
}
}
// Log what we're doing
if ($token == ':') {
$this->_writeDebug('Evaluating Range '.$this->_showValue($operand1Data['reference']).$token.$this->_showValue($operand2Data['reference']));
} else {
$this->_writeDebug('Evaluating '.$this->_showValue($operand1).' '.$token.' '.$this->_showValue($operand2));
}
// Process the operation in the appropriate manner
switch ($token) {
// Comparison (Boolean) Operators

View File

@ -27,6 +27,7 @@ Fixed in SVN:
- Bugfix: (MBaker) Work item 15459 - Invalid cell coordinate in Autofilter for Excel2007 Writer
- Bugfix: (MBaker) Work item 15518 - PCLZip library issue
- Bugfix: (MBaker) Work item 15537 - Excel2007 Reader canRead function bug
- 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
- 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