mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-30 01:06:03 +03:00
Minor performance tweaks and adjustments to Excel functions to handle a few envelope test cases
git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@85742 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
parent
a77c44d4e6
commit
2cce9b754d
@ -184,7 +184,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
|||||||
|
|
||||||
|
|
||||||
public function unsetWorksheetCells() {
|
public function unsetWorksheetCells() {
|
||||||
if(!is_null($this->_currentObject)) {
|
if ($this->_currentObject !== NULL) {
|
||||||
$this->_currentObject->detach();
|
$this->_currentObject->detach();
|
||||||
$this->_currentObject = $this->_currentObjectID = null;
|
$this->_currentObject = $this->_currentObjectID = null;
|
||||||
}
|
}
|
||||||
@ -202,7 +202,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
|
|||||||
public function __construct(PHPExcel_Worksheet $parent, $arguments) {
|
public function __construct(PHPExcel_Worksheet $parent, $arguments) {
|
||||||
$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
|
$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
|
||||||
|
|
||||||
if (is_null($this->_cachePrefix)) {
|
if ($this->_cachePrefix === NULL) {
|
||||||
$baseUnique = $this->_getUniqueID();
|
$baseUnique = $this->_getUniqueID();
|
||||||
$this->_cachePrefix = substr(md5($baseUnique),0,8).'.';
|
$this->_cachePrefix = substr(md5($baseUnique),0,8).'.';
|
||||||
$this->_cacheTime = $cacheTime;
|
$this->_cacheTime = $cacheTime;
|
||||||
|
@ -2152,8 +2152,8 @@ class PHPExcel_Calculation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read the formula from the cell
|
// Read the formula from the cell
|
||||||
if (is_null($pCell)) {
|
if ($pCell === NULL) {
|
||||||
return null;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($resetLog) {
|
if ($resetLog) {
|
||||||
@ -2188,7 +2188,7 @@ class PHPExcel_Calculation {
|
|||||||
$result = array_shift($testResult);
|
$result = array_shift($testResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_null($result)) {
|
if ($result === NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
} elseif((is_float($result)) && ((is_nan($result)) || (is_infinite($result)))) {
|
} elseif((is_float($result)) && ((is_nan($result)) || (is_infinite($result)))) {
|
||||||
return PHPExcel_Calculation_Functions::NaN();
|
return PHPExcel_Calculation_Functions::NaN();
|
||||||
@ -2268,14 +2268,14 @@ class PHPExcel_Calculation {
|
|||||||
if (!isset($formula{0})) return self::_wrapResult($formula);
|
if (!isset($formula{0})) return self::_wrapResult($formula);
|
||||||
|
|
||||||
$wsTitle = "\x00Wrk";
|
$wsTitle = "\x00Wrk";
|
||||||
if (!is_null($pCell)) {
|
if ($pCell !== NULL) {
|
||||||
$pCellParent = $pCell->getParent();
|
$pCellParent = $pCell->getParent();
|
||||||
if (!is_null($pCellParent)) {
|
if ($pCellParent !== NULL) {
|
||||||
$wsTitle = $pCellParent->getTitle();
|
$wsTitle = $pCellParent->getTitle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Is calculation cacheing enabled?
|
// Is calculation cacheing enabled?
|
||||||
if (!is_null($cellID)) {
|
if ($cellID !== NULL) {
|
||||||
if (self::$_calculationCacheEnabled) {
|
if (self::$_calculationCacheEnabled) {
|
||||||
// Is the value present in calculation cache?
|
// Is the value present in calculation cache?
|
||||||
// echo 'Testing cache value<br />';
|
// echo 'Testing cache value<br />';
|
||||||
@ -2328,7 +2328,7 @@ class PHPExcel_Calculation {
|
|||||||
array_pop($this->debugLogStack);
|
array_pop($this->debugLogStack);
|
||||||
|
|
||||||
// Save to calculation cache
|
// Save to calculation cache
|
||||||
if (!is_null($cellID)) {
|
if ($cellID !== NULL) {
|
||||||
if (self::$_calculationCacheEnabled) {
|
if (self::$_calculationCacheEnabled) {
|
||||||
self::$_calculationCache[$wsTitle][$cellID]['time'] = microtime(true);
|
self::$_calculationCache[$wsTitle][$cellID]['time'] = microtime(true);
|
||||||
self::$_calculationCache[$wsTitle][$cellID]['data'] = $cellValue;
|
self::$_calculationCache[$wsTitle][$cellID]['data'] = $cellValue;
|
||||||
@ -2534,7 +2534,7 @@ class PHPExcel_Calculation {
|
|||||||
$value = array_pop($testArray);
|
$value = array_pop($testArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_null($value)) {
|
if ($value === NULL) {
|
||||||
return 'a NULL value';
|
return 'a NULL value';
|
||||||
} elseif (is_float($value)) {
|
} elseif (is_float($value)) {
|
||||||
$typeString = 'a floating point number';
|
$typeString = 'a floating point number';
|
||||||
@ -2617,12 +2617,12 @@ class PHPExcel_Calculation {
|
|||||||
// Convert infix to postfix notation
|
// Convert infix to postfix notation
|
||||||
private function _parseFormula($formula, PHPExcel_Cell $pCell = null) {
|
private function _parseFormula($formula, PHPExcel_Cell $pCell = null) {
|
||||||
if (($formula = self::_convertMatrixReferences(trim($formula))) === false) {
|
if (($formula = self::_convertMatrixReferences(trim($formula))) === false) {
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're using cell caching, then $pCell may well be flushed back to the cache (which detaches the parent worksheet),
|
// If we're using cell caching, then $pCell may well be flushed back to the cache (which detaches the parent worksheet),
|
||||||
// so we store the parent worksheet so that we can re-attach it when necessary
|
// so we store the parent worksheet so that we can re-attach it when necessary
|
||||||
$pCellParent = (!is_null($pCell)) ? $pCell->getParent() : null;
|
$pCellParent = ($pCell !== NULL) ? $pCell->getParent() : NULL;
|
||||||
|
|
||||||
// Binary Operators
|
// Binary Operators
|
||||||
// These operators always work on two values
|
// These operators always work on two values
|
||||||
@ -2715,7 +2715,7 @@ class PHPExcel_Calculation {
|
|||||||
// echo 'Element is a Closing bracket<br />';
|
// echo 'Element is a Closing bracket<br />';
|
||||||
$expectingOperand = false;
|
$expectingOperand = false;
|
||||||
while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last (
|
while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last (
|
||||||
if (is_null($o2)) return $this->_raiseFormulaError('Formula Error: Unexpected closing brace ")"');
|
if ($o2 === NULL) return $this->_raiseFormulaError('Formula Error: Unexpected closing brace ")"');
|
||||||
else $output[] = $o2;
|
else $output[] = $o2;
|
||||||
}
|
}
|
||||||
$d = $stack->last(2);
|
$d = $stack->last(2);
|
||||||
@ -2794,7 +2794,7 @@ class PHPExcel_Calculation {
|
|||||||
} elseif ($opCharacter == ',') { // Is this the separator for function arguments?
|
} elseif ($opCharacter == ',') { // Is this the separator for function arguments?
|
||||||
// echo 'Element is a Function argument separator<br />';
|
// echo 'Element is a Function argument separator<br />';
|
||||||
while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last (
|
while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last (
|
||||||
if (is_null($o2)) return $this->_raiseFormulaError("Formula Error: Unexpected ,");
|
if ($o2 === NULL) return $this->_raiseFormulaError("Formula Error: Unexpected ,");
|
||||||
else $output[] = $o2; // pop the argument expression stuff and push onto the output
|
else $output[] = $o2; // pop the argument expression stuff and push onto the output
|
||||||
}
|
}
|
||||||
// If we've a comma when we're expecting an operand, then what we actually have is a null operand;
|
// If we've a comma when we're expecting an operand, then what we actually have is a null operand;
|
||||||
@ -2885,13 +2885,13 @@ class PHPExcel_Calculation {
|
|||||||
if ((is_integer($startRowColRef)) && (ctype_digit($val)) &&
|
if ((is_integer($startRowColRef)) && (ctype_digit($val)) &&
|
||||||
($startRowColRef <= 1048576) && ($val <= 1048576)) {
|
($startRowColRef <= 1048576) && ($val <= 1048576)) {
|
||||||
// Row range
|
// Row range
|
||||||
$endRowColRef = (!is_null($pCellParent)) ? $pCellParent->getHighestColumn() : 'XFD'; // Max 16,384 columns for Excel2007
|
$endRowColRef = ($pCellParent !== NULL) ? $pCellParent->getHighestColumn() : 'XFD'; // Max 16,384 columns for Excel2007
|
||||||
$output[count($output)-1]['value'] = $rangeWS1.'A'.$startRowColRef;
|
$output[count($output)-1]['value'] = $rangeWS1.'A'.$startRowColRef;
|
||||||
$val = $rangeWS2.$endRowColRef.$val;
|
$val = $rangeWS2.$endRowColRef.$val;
|
||||||
} elseif ((ctype_alpha($startRowColRef)) && (ctype_alpha($val)) &&
|
} elseif ((ctype_alpha($startRowColRef)) && (ctype_alpha($val)) &&
|
||||||
(strlen($startRowColRef) <= 3) && (strlen($val) <= 3)) {
|
(strlen($startRowColRef) <= 3) && (strlen($val) <= 3)) {
|
||||||
// Column range
|
// Column range
|
||||||
$endRowColRef = (!is_null($pCellParent)) ? $pCellParent->getHighestRow() : 1048576; // Max 1,048,576 rows for Excel2007
|
$endRowColRef = ($pCellParent !== NULL) ? $pCellParent->getHighestRow() : 1048576; // Max 1,048,576 rows for Excel2007
|
||||||
$output[count($output)-1]['value'] = $rangeWS1.strtoupper($startRowColRef).'1';
|
$output[count($output)-1]['value'] = $rangeWS1.strtoupper($startRowColRef).'1';
|
||||||
$val = $rangeWS2.$val.$endRowColRef;
|
$val = $rangeWS2.$val.$endRowColRef;
|
||||||
}
|
}
|
||||||
@ -2976,7 +2976,7 @@ class PHPExcel_Calculation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!is_null($op = $stack->pop())) { // pop everything off the stack and push onto output
|
while (($op = $stack->pop()) !== NULL) { // pop everything off the stack and push onto output
|
||||||
if ($opCharacter['value'] == '(') return $this->_raiseFormulaError("Formula Error: Expecting ')'"); // if there are any opening braces on the stack, then braces were unbalanced
|
if ($opCharacter['value'] == '(') return $this->_raiseFormulaError("Formula Error: Expecting ')'"); // if there are any opening braces on the stack, then braces were unbalanced
|
||||||
$output[] = $op;
|
$output[] = $op;
|
||||||
}
|
}
|
||||||
@ -2990,7 +2990,7 @@ class PHPExcel_Calculation {
|
|||||||
|
|
||||||
// If we're using cell caching, then $pCell may well be flushed back to the cache (which detaches the parent worksheet),
|
// If we're using cell caching, then $pCell may well be flushed back to the cache (which detaches the parent worksheet),
|
||||||
// so we store the parent worksheet so that we can re-attach it when necessary
|
// so we store the parent worksheet so that we can re-attach it when necessary
|
||||||
$pCellParent = (!is_null($pCell)) ? $pCell->getParent() : null;
|
$pCellParent = ($pCell !== NULL) ? $pCell->getParent() : null;
|
||||||
$stack = new PHPExcel_Token_Stack;
|
$stack = new PHPExcel_Token_Stack;
|
||||||
|
|
||||||
// Loop through each token in turn
|
// Loop through each token in turn
|
||||||
@ -3003,11 +3003,11 @@ class PHPExcel_Calculation {
|
|||||||
if (isset(self::$_binaryOperators[$token])) {
|
if (isset(self::$_binaryOperators[$token])) {
|
||||||
// echo 'Token is a binary operator<br />';
|
// echo 'Token is a binary operator<br />';
|
||||||
// We must have two operands, error if we don't
|
// 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 (($operand2Data = $stack->pop()) === NULL) 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');
|
if (($operand1Data = $stack->pop()) === NULL) return $this->_raiseFormulaError('Internal error - Operand value missing from stack');
|
||||||
|
|
||||||
$operand1 = $operand1Data['value'];
|
$operand1 = $operand1Data['value'];
|
||||||
if ((is_null($operand1Data['reference'])) && (is_array($operand1))) {
|
if (($operand1Data['reference'] === NULL) && (is_array($operand1))) {
|
||||||
$rowKey = array_shift(array_keys($operand1));
|
$rowKey = array_shift(array_keys($operand1));
|
||||||
$colKey = array_shift(array_keys($operand1[$rowKey]));
|
$colKey = array_shift(array_keys($operand1[$rowKey]));
|
||||||
if (ctype_upper($colKey)) {
|
if (ctype_upper($colKey)) {
|
||||||
@ -3015,7 +3015,7 @@ class PHPExcel_Calculation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$operand2 = $operand2Data['value'];
|
$operand2 = $operand2Data['value'];
|
||||||
if ((is_null($operand2Data['reference'])) && (is_array($operand2))) {
|
if (($operand2Data['reference'] === NULL) && (is_array($operand2))) {
|
||||||
$rowKey = array_shift(array_keys($operand2));
|
$rowKey = array_shift(array_keys($operand2));
|
||||||
$colKey = array_shift(array_keys($operand2[$rowKey]));
|
$colKey = array_shift(array_keys($operand2[$rowKey]));
|
||||||
if (ctype_upper($colKey)) {
|
if (ctype_upper($colKey)) {
|
||||||
@ -3047,7 +3047,7 @@ class PHPExcel_Calculation {
|
|||||||
if (strpos($operand1Data['reference'],'!') !== false) {
|
if (strpos($operand1Data['reference'],'!') !== false) {
|
||||||
list($sheet1,$operand1Data['reference']) = explode('!',$operand1Data['reference']);
|
list($sheet1,$operand1Data['reference']) = explode('!',$operand1Data['reference']);
|
||||||
} else {
|
} else {
|
||||||
$sheet1 = (!is_null($pCellParent)) ? $pCellParent->getTitle() : '';
|
$sheet1 = ($pCellParent !== NULL) ? $pCellParent->getTitle() : '';
|
||||||
}
|
}
|
||||||
if (strpos($operand2Data['reference'],'!') !== false) {
|
if (strpos($operand2Data['reference'],'!') !== false) {
|
||||||
list($sheet2,$operand2Data['reference']) = explode('!',$operand2Data['reference']);
|
list($sheet2,$operand2Data['reference']) = explode('!',$operand2Data['reference']);
|
||||||
@ -3055,7 +3055,7 @@ class PHPExcel_Calculation {
|
|||||||
$sheet2 = $sheet1;
|
$sheet2 = $sheet1;
|
||||||
}
|
}
|
||||||
if ($sheet1 == $sheet2) {
|
if ($sheet1 == $sheet2) {
|
||||||
if (is_null($operand1Data['reference'])) {
|
if ($operand1Data['reference'] === NULL) {
|
||||||
if ((trim($operand1Data['value']) != '') && (is_numeric($operand1Data['value']))) {
|
if ((trim($operand1Data['value']) != '') && (is_numeric($operand1Data['value']))) {
|
||||||
$operand1Data['reference'] = $pCell->getColumn().$operand1Data['value'];
|
$operand1Data['reference'] = $pCell->getColumn().$operand1Data['value'];
|
||||||
} elseif (trim($operand1Data['reference']) == '') {
|
} elseif (trim($operand1Data['reference']) == '') {
|
||||||
@ -3064,7 +3064,7 @@ class PHPExcel_Calculation {
|
|||||||
$operand1Data['reference'] = $operand1Data['value'].$pCell->getRow();
|
$operand1Data['reference'] = $operand1Data['value'].$pCell->getRow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (is_null($operand2Data['reference'])) {
|
if ($operand2Data['reference'] === NULL) {
|
||||||
if ((trim($operand2Data['value']) != '') && (is_numeric($operand2Data['value']))) {
|
if ((trim($operand2Data['value']) != '') && (is_numeric($operand2Data['value']))) {
|
||||||
$operand2Data['reference'] = $pCell->getColumn().$operand2Data['value'];
|
$operand2Data['reference'] = $pCell->getColumn().$operand2Data['value'];
|
||||||
} elseif (trim($operand2Data['reference']) == '') {
|
} elseif (trim($operand2Data['reference']) == '') {
|
||||||
@ -3082,7 +3082,7 @@ class PHPExcel_Calculation {
|
|||||||
$oRow[] = $oCR[1];
|
$oRow[] = $oCR[1];
|
||||||
}
|
}
|
||||||
$cellRef = PHPExcel_Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.PHPExcel_Cell::stringFromColumnIndex(max($oCol)).max($oRow);
|
$cellRef = PHPExcel_Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.PHPExcel_Cell::stringFromColumnIndex(max($oCol)).max($oRow);
|
||||||
if (!is_null($pCellParent)) {
|
if ($pCellParent !== NULL) {
|
||||||
$cellValue = $this->extractCellRange($cellRef, $pCellParent->getParent()->getSheetByName($sheet1), false);
|
$cellValue = $this->extractCellRange($cellRef, $pCellParent->getParent()->getSheetByName($sheet1), false);
|
||||||
} else {
|
} else {
|
||||||
return $this->_raiseFormulaError('Unable to access Cell Reference');
|
return $this->_raiseFormulaError('Unable to access Cell Reference');
|
||||||
@ -3156,7 +3156,7 @@ class PHPExcel_Calculation {
|
|||||||
// if the token is a unary operator, pop one value off the stack, do the operation, and push it back on
|
// if the token is a unary operator, pop one value off the stack, do the operation, and push it back on
|
||||||
} elseif (($token === '~') || ($token === '%')) {
|
} elseif (($token === '~') || ($token === '%')) {
|
||||||
// echo 'Token is a unary operator<br />';
|
// echo 'Token is a unary operator<br />';
|
||||||
if (is_null($arg = $stack->pop())) return $this->_raiseFormulaError('Internal error - Operand value missing from stack');
|
if (($arg = $stack->pop()) === NULL) return $this->_raiseFormulaError('Internal error - Operand value missing from stack');
|
||||||
$arg = $arg['value'];
|
$arg = $arg['value'];
|
||||||
if ($token === '~') {
|
if ($token === '~') {
|
||||||
// echo 'Token is a negation operator<br />';
|
// echo 'Token is a negation operator<br />';
|
||||||
@ -3188,7 +3188,7 @@ class PHPExcel_Calculation {
|
|||||||
// echo 'Element '.$token.' is a Cell reference<br />';
|
// echo 'Element '.$token.' is a Cell reference<br />';
|
||||||
if (isset($matches[8])) {
|
if (isset($matches[8])) {
|
||||||
// echo 'Reference is a Range of cells<br />';
|
// echo 'Reference is a Range of cells<br />';
|
||||||
if (is_null($pCell)) {
|
if ($pCell === NULL) {
|
||||||
// We can't access the range, so return a REF error
|
// We can't access the range, so return a REF error
|
||||||
$cellValue = PHPExcel_Calculation_Functions::REF();
|
$cellValue = PHPExcel_Calculation_Functions::REF();
|
||||||
} else {
|
} else {
|
||||||
@ -3202,7 +3202,7 @@ class PHPExcel_Calculation {
|
|||||||
$matches[2] = trim($matches[2],"\"'");
|
$matches[2] = trim($matches[2],"\"'");
|
||||||
// echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
|
// echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
|
||||||
$this->_writeDebug('Evaluating Cell Range '.$cellRef.' in worksheet '.$matches[2]);
|
$this->_writeDebug('Evaluating Cell Range '.$cellRef.' in worksheet '.$matches[2]);
|
||||||
if (!is_null($pCellParent)) {
|
if ($pCellParent !== NULL) {
|
||||||
$cellValue = $this->extractCellRange($cellRef, $pCellParent->getParent()->getSheetByName($matches[2]), false);
|
$cellValue = $this->extractCellRange($cellRef, $pCellParent->getParent()->getSheetByName($matches[2]), false);
|
||||||
} else {
|
} else {
|
||||||
return $this->_raiseFormulaError('Unable to access Cell Reference');
|
return $this->_raiseFormulaError('Unable to access Cell Reference');
|
||||||
@ -3212,7 +3212,7 @@ class PHPExcel_Calculation {
|
|||||||
} else {
|
} else {
|
||||||
// echo '$cellRef='.$cellRef.' in current worksheet<br />';
|
// echo '$cellRef='.$cellRef.' in current worksheet<br />';
|
||||||
$this->_writeDebug('Evaluating Cell Range '.$cellRef.' in current worksheet');
|
$this->_writeDebug('Evaluating Cell Range '.$cellRef.' in current worksheet');
|
||||||
if (!is_null($pCellParent)) {
|
if ($pCellParent !== NULL) {
|
||||||
$cellValue = $this->extractCellRange($cellRef, $pCellParent, false);
|
$cellValue = $this->extractCellRange($cellRef, $pCellParent, false);
|
||||||
} else {
|
} else {
|
||||||
return $this->_raiseFormulaError('Unable to access Cell Reference');
|
return $this->_raiseFormulaError('Unable to access Cell Reference');
|
||||||
@ -3222,7 +3222,7 @@ class PHPExcel_Calculation {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// echo 'Reference is a single Cell<br />';
|
// echo 'Reference is a single Cell<br />';
|
||||||
if (is_null($pCell)) {
|
if ($pCell !== NULL) {
|
||||||
// We can't access the cell, so return a REF error
|
// We can't access the cell, so return a REF error
|
||||||
$cellValue = PHPExcel_Calculation_Functions::REF();
|
$cellValue = PHPExcel_Calculation_Functions::REF();
|
||||||
} else {
|
} else {
|
||||||
@ -3235,7 +3235,7 @@ class PHPExcel_Calculation {
|
|||||||
}
|
}
|
||||||
// echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
|
// echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
|
||||||
$this->_writeDebug('Evaluating Cell '.$cellRef.' in worksheet '.$matches[2]);
|
$this->_writeDebug('Evaluating Cell '.$cellRef.' in worksheet '.$matches[2]);
|
||||||
if (!is_null($pCellParent)) {
|
if ($pCellParent !== NULL) {
|
||||||
if ($pCellParent->getParent()->getSheetByName($matches[2])->cellExists($cellRef)) {
|
if ($pCellParent->getParent()->getSheetByName($matches[2])->cellExists($cellRef)) {
|
||||||
$cellValue = $this->extractCellRange($cellRef, $pCellParent->getParent()->getSheetByName($matches[2]), false);
|
$cellValue = $this->extractCellRange($cellRef, $pCellParent->getParent()->getSheetByName($matches[2]), false);
|
||||||
$pCell->attach($pCellParent);
|
$pCell->attach($pCellParent);
|
||||||
@ -3290,7 +3290,7 @@ class PHPExcel_Calculation {
|
|||||||
if (($passByReference) &&
|
if (($passByReference) &&
|
||||||
(isset(self::$_PHPExcelFunctions[$functionName]['passByReference'][$a])) &&
|
(isset(self::$_PHPExcelFunctions[$functionName]['passByReference'][$a])) &&
|
||||||
(self::$_PHPExcelFunctions[$functionName]['passByReference'][$a])) {
|
(self::$_PHPExcelFunctions[$functionName]['passByReference'][$a])) {
|
||||||
if (is_null($arg['reference'])) {
|
if ($arg['reference'] === NULL) {
|
||||||
$args[] = $cellID;
|
$args[] = $cellID;
|
||||||
if ($functionName != 'MKMATRIX') { $argArrayVals[] = $this->_showValue($cellID); }
|
if ($functionName != 'MKMATRIX') { $argArrayVals[] = $this->_showValue($cellID); }
|
||||||
} else {
|
} else {
|
||||||
@ -3367,7 +3367,7 @@ class PHPExcel_Calculation {
|
|||||||
// echo 'Token is a PHPExcel constant: '.$excelConstant.'<br />';
|
// echo 'Token is a PHPExcel constant: '.$excelConstant.'<br />';
|
||||||
$stack->push('Constant Value',self::$_ExcelConstants[$excelConstant]);
|
$stack->push('Constant Value',self::$_ExcelConstants[$excelConstant]);
|
||||||
$this->_writeDebug('Evaluating Constant '.$excelConstant.' as '.$this->_showTypeDetails(self::$_ExcelConstants[$excelConstant]));
|
$this->_writeDebug('Evaluating Constant '.$excelConstant.' as '.$this->_showTypeDetails(self::$_ExcelConstants[$excelConstant]));
|
||||||
} elseif ((is_numeric($token)) || (is_null($token)) || (is_bool($token)) || ($token == '') || ($token{0} == '"') || ($token{0} == '#')) {
|
} elseif ((is_numeric($token)) || ($token === NULL) || (is_bool($token)) || ($token == '') || ($token{0} == '"') || ($token{0} == '#')) {
|
||||||
// echo 'Token is a number, boolean, string, null or an Excel error<br />';
|
// echo 'Token is a number, boolean, string, null or an Excel error<br />';
|
||||||
$stack->push('Value',$token);
|
$stack->push('Value',$token);
|
||||||
// if the token is a named range, push the named range name onto the stack
|
// if the token is a named range, push the named range name onto the stack
|
||||||
@ -3611,7 +3611,7 @@ class PHPExcel_Calculation {
|
|||||||
$returnValue = array ();
|
$returnValue = array ();
|
||||||
|
|
||||||
// echo 'extractCellRange('.$pRange.')<br />';
|
// echo 'extractCellRange('.$pRange.')<br />';
|
||||||
if (!is_null($pSheet)) {
|
if ($pSheet !== NULL) {
|
||||||
// echo 'Passed sheet name is '.$pSheet->getTitle().'<br />';
|
// echo 'Passed sheet name is '.$pSheet->getTitle().'<br />';
|
||||||
// echo 'Range reference is '.$pRange.'<br />';
|
// echo 'Range reference is '.$pRange.'<br />';
|
||||||
if (strpos ($pRange, '!') !== false) {
|
if (strpos ($pRange, '!') !== false) {
|
||||||
@ -3667,7 +3667,7 @@ class PHPExcel_Calculation {
|
|||||||
$returnValue = array ();
|
$returnValue = array ();
|
||||||
|
|
||||||
// echo 'extractNamedRange('.$pRange.')<br />';
|
// echo 'extractNamedRange('.$pRange.')<br />';
|
||||||
if (!is_null($pSheet)) {
|
if ($pSheet !== NULL) {
|
||||||
// echo 'Current sheet name is '.$pSheet->getTitle().'<br />';
|
// echo 'Current sheet name is '.$pSheet->getTitle().'<br />';
|
||||||
// echo 'Range reference is '.$pRange.'<br />';
|
// echo 'Range reference is '.$pRange.'<br />';
|
||||||
if (strpos ($pRange, '!') !== false) {
|
if (strpos ($pRange, '!') !== false) {
|
||||||
@ -3681,7 +3681,7 @@ class PHPExcel_Calculation {
|
|||||||
|
|
||||||
// Named range?
|
// Named range?
|
||||||
$namedRange = PHPExcel_NamedRange::resolveRange($pRange, $pSheet);
|
$namedRange = PHPExcel_NamedRange::resolveRange($pRange, $pSheet);
|
||||||
if (!is_null($namedRange)) {
|
if ($namedRange !== NULL) {
|
||||||
$pSheet = $namedRange->getWorksheet();
|
$pSheet = $namedRange->getWorksheet();
|
||||||
// echo 'Named Range '.$pRange.' (';
|
// echo 'Named Range '.$pRange.' (';
|
||||||
$pRange = $namedRange->getRange();
|
$pRange = $namedRange->getRange();
|
||||||
|
@ -182,7 +182,7 @@ class PHPExcel_Calculation_DateTime {
|
|||||||
$retValue = (float) $excelDateTime;
|
$retValue = (float) $excelDateTime;
|
||||||
break;
|
break;
|
||||||
case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC :
|
case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC :
|
||||||
$retValue = (integer) PHPExcel_Shared_Date::ExcelToPHP($excelDateTime) - 3600;
|
$retValue = (integer) PHPExcel_Shared_Date::ExcelToPHP($excelDateTime);
|
||||||
break;
|
break;
|
||||||
case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT :
|
case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT :
|
||||||
$retValue = PHPExcel_Shared_Date::ExcelToPHPObject($excelDateTime);
|
$retValue = PHPExcel_Shared_Date::ExcelToPHPObject($excelDateTime);
|
||||||
@ -204,9 +204,21 @@ class PHPExcel_Calculation_DateTime {
|
|||||||
* depending on the value of the ReturnDateType flag
|
* depending on the value of the ReturnDateType flag
|
||||||
*/
|
*/
|
||||||
public static function DATE($year = 0, $month = 1, $day = 1) {
|
public static function DATE($year = 0, $month = 1, $day = 1) {
|
||||||
$year = (integer) PHPExcel_Calculation_Functions::flattenSingleValue($year);
|
$year = PHPExcel_Calculation_Functions::flattenSingleValue($year);
|
||||||
$month = (integer) PHPExcel_Calculation_Functions::flattenSingleValue($month);
|
$month = PHPExcel_Calculation_Functions::flattenSingleValue($month);
|
||||||
$day = (integer) PHPExcel_Calculation_Functions::flattenSingleValue($day);
|
$day = PHPExcel_Calculation_Functions::flattenSingleValue($day);
|
||||||
|
|
||||||
|
$year = ($year !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($year) : 0;
|
||||||
|
$month = ($month !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($month) : 0;
|
||||||
|
$day = ($day !== NULL) ? PHPExcel_Shared_String::testStringAsNumeric($day) : 0;
|
||||||
|
if ((!is_numeric($year)) ||
|
||||||
|
(!is_numeric($month)) ||
|
||||||
|
(!is_numeric($day))) {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
}
|
||||||
|
$year = (integer) $year;
|
||||||
|
$month = (integer) $month;
|
||||||
|
$day = (integer) $day;
|
||||||
|
|
||||||
$baseYear = PHPExcel_Shared_Date::getExcelCalendar();
|
$baseYear = PHPExcel_Shared_Date::getExcelCalendar();
|
||||||
// Validate parameters
|
// Validate parameters
|
||||||
@ -312,7 +324,7 @@ class PHPExcel_Calculation_DateTime {
|
|||||||
return (float) PHPExcel_Shared_Date::FormattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second);
|
return (float) PHPExcel_Shared_Date::FormattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second);
|
||||||
break;
|
break;
|
||||||
case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC :
|
case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC :
|
||||||
return (integer) PHPExcel_Shared_Date::ExcelToPHP(PHPExcel_Shared_Date::FormattedPHPToExcel(1970, 1, 1, $hour-1, $minute, $second)); // -2147468400; // -2147472000 + 3600
|
return (integer) PHPExcel_Shared_Date::ExcelToPHP(PHPExcel_Shared_Date::FormattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; // -2147472000 + 3600
|
||||||
break;
|
break;
|
||||||
case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT :
|
case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT :
|
||||||
$dayAdjust = 0;
|
$dayAdjust = 0;
|
||||||
@ -402,6 +414,8 @@ class PHPExcel_Calculation_DateTime {
|
|||||||
if (($PHPDateArray !== False) && ($PHPDateArray['error_count'] == 0)) {
|
if (($PHPDateArray !== False) && ($PHPDateArray['error_count'] == 0)) {
|
||||||
// Execute function
|
// Execute function
|
||||||
if ($PHPDateArray['year'] == '') { $PHPDateArray['year'] = strftime('%Y'); }
|
if ($PHPDateArray['year'] == '') { $PHPDateArray['year'] = strftime('%Y'); }
|
||||||
|
if ($PHPDateArray['year'] < 1900)
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
if ($PHPDateArray['month'] == '') { $PHPDateArray['month'] = strftime('%m'); }
|
if ($PHPDateArray['month'] == '') { $PHPDateArray['month'] = strftime('%m'); }
|
||||||
if ($PHPDateArray['day'] == '') { $PHPDateArray['day'] = strftime('%d'); }
|
if ($PHPDateArray['day'] == '') { $PHPDateArray['day'] = strftime('%d'); }
|
||||||
$excelDateValue = floor(PHPExcel_Shared_Date::FormattedPHPToExcel($PHPDateArray['year'],$PHPDateArray['month'],$PHPDateArray['day'],$PHPDateArray['hour'],$PHPDateArray['minute'],$PHPDateArray['second']));
|
$excelDateValue = floor(PHPExcel_Shared_Date::FormattedPHPToExcel($PHPDateArray['year'],$PHPDateArray['month'],$PHPDateArray['day'],$PHPDateArray['hour'],$PHPDateArray['minute'],$PHPDateArray['second']));
|
||||||
@ -792,7 +806,7 @@ class PHPExcel_Calculation_DateTime {
|
|||||||
if (!empty($dateArgs)) {
|
if (!empty($dateArgs)) {
|
||||||
$holidayCountedArray = $holidayDates = array();
|
$holidayCountedArray = $holidayDates = array();
|
||||||
foreach ($dateArgs as $holidayDate) {
|
foreach ($dateArgs as $holidayDate) {
|
||||||
if ((!is_null($holidayDate)) && (trim($holidayDate) > '')) {
|
if (($holidayDate !== NULL) && (trim($holidayDate) > '')) {
|
||||||
if (is_string($holidayDate = self::_getDateValue($holidayDate))) {
|
if (is_string($holidayDate = self::_getDateValue($holidayDate))) {
|
||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
}
|
}
|
||||||
@ -877,7 +891,14 @@ class PHPExcel_Calculation_DateTime {
|
|||||||
*/
|
*/
|
||||||
public static function DAYOFWEEK($dateValue = 1, $style = 1) {
|
public static function DAYOFWEEK($dateValue = 1, $style = 1) {
|
||||||
$dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
|
$dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
|
||||||
$style = floor(PHPExcel_Calculation_Functions::flattenSingleValue($style));
|
$style = PHPExcel_Calculation_Functions::flattenSingleValue($style);
|
||||||
|
|
||||||
|
if (!is_numeric($style)) {
|
||||||
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
|
} elseif (($style < 1) || ($style > 3)) {
|
||||||
|
return PHPExcel_Calculation_Functions::NaN();
|
||||||
|
}
|
||||||
|
$style = floor($style);
|
||||||
|
|
||||||
if (is_string($dateValue = self::_getDateValue($dateValue))) {
|
if (is_string($dateValue = self::_getDateValue($dateValue))) {
|
||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
@ -899,7 +920,6 @@ class PHPExcel_Calculation_DateTime {
|
|||||||
$firstDay = 0;
|
$firstDay = 0;
|
||||||
--$DoW;
|
--$DoW;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
}
|
}
|
||||||
if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL) {
|
if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL) {
|
||||||
// Test for Excel's 1900 leap year, and introduce the error as required
|
// Test for Excel's 1900 leap year, and introduce the error as required
|
||||||
@ -924,13 +944,14 @@ class PHPExcel_Calculation_DateTime {
|
|||||||
*/
|
*/
|
||||||
public static function WEEKOFYEAR($dateValue = 1, $method = 1) {
|
public static function WEEKOFYEAR($dateValue = 1, $method = 1) {
|
||||||
$dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
|
$dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
|
||||||
$method = floor(PHPExcel_Calculation_Functions::flattenSingleValue($method));
|
$method = PHPExcel_Calculation_Functions::flattenSingleValue($method);
|
||||||
|
|
||||||
if (!is_numeric($method)) {
|
if (!is_numeric($method)) {
|
||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
} elseif (($method < 1) || ($method > 2)) {
|
} elseif (($method < 1) || ($method > 2)) {
|
||||||
return PHPExcel_Calculation_Functions::NaN();
|
return PHPExcel_Calculation_Functions::NaN();
|
||||||
}
|
}
|
||||||
|
$method = floor($method);
|
||||||
|
|
||||||
if (is_string($dateValue = self::_getDateValue($dateValue))) {
|
if (is_string($dateValue = self::_getDateValue($dateValue))) {
|
||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
@ -1107,11 +1128,12 @@ class PHPExcel_Calculation_DateTime {
|
|||||||
*/
|
*/
|
||||||
public static function EDATE($dateValue = 1, $adjustmentMonths = 0) {
|
public static function EDATE($dateValue = 1, $adjustmentMonths = 0) {
|
||||||
$dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
|
$dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
|
||||||
$adjustmentMonths = floor(PHPExcel_Calculation_Functions::flattenSingleValue($adjustmentMonths));
|
$adjustmentMonths = PHPExcel_Calculation_Functions::flattenSingleValue($adjustmentMonths);
|
||||||
|
|
||||||
if (!is_numeric($adjustmentMonths)) {
|
if (!is_numeric($adjustmentMonths)) {
|
||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
}
|
}
|
||||||
|
$adjustmentMonths = floor($adjustmentMonths);
|
||||||
|
|
||||||
if (is_string($dateValue = self::_getDateValue($dateValue))) {
|
if (is_string($dateValue = self::_getDateValue($dateValue))) {
|
||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
@ -1146,11 +1168,12 @@ class PHPExcel_Calculation_DateTime {
|
|||||||
*/
|
*/
|
||||||
public static function EOMONTH($dateValue = 1, $adjustmentMonths = 0) {
|
public static function EOMONTH($dateValue = 1, $adjustmentMonths = 0) {
|
||||||
$dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
|
$dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
|
||||||
$adjustmentMonths = floor(PHPExcel_Calculation_Functions::flattenSingleValue($adjustmentMonths));
|
$adjustmentMonths = PHPExcel_Calculation_Functions::flattenSingleValue($adjustmentMonths);
|
||||||
|
|
||||||
if (!is_numeric($adjustmentMonths)) {
|
if (!is_numeric($adjustmentMonths)) {
|
||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
}
|
}
|
||||||
|
$adjustmentMonths = floor($adjustmentMonths);
|
||||||
|
|
||||||
if (is_string($dateValue = self::_getDateValue($dateValue))) {
|
if (is_string($dateValue = self::_getDateValue($dateValue))) {
|
||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
@ -1176,3 +1199,4 @@ class PHPExcel_Calculation_DateTime {
|
|||||||
} // function EOMONTH()
|
} // function EOMONTH()
|
||||||
|
|
||||||
} // class PHPExcel_Calculation_DateTime
|
} // class PHPExcel_Calculation_DateTime
|
||||||
|
|
||||||
|
@ -2046,7 +2046,7 @@ class PHPExcel_Calculation_Engineering {
|
|||||||
if (!is_numeric($value)) {
|
if (!is_numeric($value)) {
|
||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
}
|
}
|
||||||
$fromMultiplier = 1;
|
$fromMultiplier = 1.0;
|
||||||
if (isset(self::$_conversionUnits[$fromUOM])) {
|
if (isset(self::$_conversionUnits[$fromUOM])) {
|
||||||
$unitGroup1 = self::$_conversionUnits[$fromUOM]['Group'];
|
$unitGroup1 = self::$_conversionUnits[$fromUOM]['Group'];
|
||||||
} else {
|
} else {
|
||||||
@ -2065,7 +2065,7 @@ class PHPExcel_Calculation_Engineering {
|
|||||||
}
|
}
|
||||||
$value *= $fromMultiplier;
|
$value *= $fromMultiplier;
|
||||||
|
|
||||||
$toMultiplier = 1;
|
$toMultiplier = 1.0;
|
||||||
if (isset(self::$_conversionUnits[$toUOM])) {
|
if (isset(self::$_conversionUnits[$toUOM])) {
|
||||||
$unitGroup2 = self::$_conversionUnits[$toUOM]['Group'];
|
$unitGroup2 = self::$_conversionUnits[$toUOM]['Group'];
|
||||||
} else {
|
} else {
|
||||||
@ -2086,12 +2086,12 @@ class PHPExcel_Calculation_Engineering {
|
|||||||
return PHPExcel_Calculation_Functions::NA();
|
return PHPExcel_Calculation_Functions::NA();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($fromUOM == $toUOM) {
|
if (($fromUOM == $toUOM) && ($fromMultiplier == $toMultiplier)) {
|
||||||
return 1.0;
|
return $value;
|
||||||
} elseif ($unitGroup1 == 'Temperature') {
|
} elseif ($unitGroup1 == 'Temperature') {
|
||||||
if (($fromUOM == 'F') || ($fromUOM == 'fah')) {
|
if (($fromUOM == 'F') || ($fromUOM == 'fah')) {
|
||||||
if (($toUOM == 'F') || ($toUOM == 'fah')) {
|
if (($toUOM == 'F') || ($toUOM == 'fah')) {
|
||||||
return 1.0;
|
return $value;
|
||||||
} else {
|
} else {
|
||||||
$value = (($value - 32) / 1.8);
|
$value = (($value - 32) / 1.8);
|
||||||
if (($toUOM == 'K') || ($toUOM == 'kel')) {
|
if (($toUOM == 'K') || ($toUOM == 'kel')) {
|
||||||
@ -2101,10 +2101,10 @@ class PHPExcel_Calculation_Engineering {
|
|||||||
}
|
}
|
||||||
} elseif ((($fromUOM == 'K') || ($fromUOM == 'kel')) &&
|
} elseif ((($fromUOM == 'K') || ($fromUOM == 'kel')) &&
|
||||||
(($toUOM == 'K') || ($toUOM == 'kel'))) {
|
(($toUOM == 'K') || ($toUOM == 'kel'))) {
|
||||||
return 1.0;
|
return $value;
|
||||||
} elseif ((($fromUOM == 'C') || ($fromUOM == 'cel')) &&
|
} elseif ((($fromUOM == 'C') || ($fromUOM == 'cel')) &&
|
||||||
(($toUOM == 'C') || ($toUOM == 'cel'))) {
|
(($toUOM == 'C') || ($toUOM == 'cel'))) {
|
||||||
return 1.0;
|
return $value;
|
||||||
}
|
}
|
||||||
if (($toUOM == 'F') || ($toUOM == 'fah')) {
|
if (($toUOM == 'F') || ($toUOM == 'fah')) {
|
||||||
if (($fromUOM == 'K') || ($fromUOM == 'kel')) {
|
if (($fromUOM == 'K') || ($fromUOM == 'kel')) {
|
||||||
|
@ -357,6 +357,11 @@ class PHPExcel_Calculation_MathTrig {
|
|||||||
public static function INT($number) {
|
public static function INT($number) {
|
||||||
$number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
|
$number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
|
||||||
|
|
||||||
|
if (is_null($number)) {
|
||||||
|
return 0;
|
||||||
|
} elseif (is_bool($number)) {
|
||||||
|
return (int) $number;
|
||||||
|
}
|
||||||
if (is_numeric($number)) {
|
if (is_numeric($number)) {
|
||||||
return (int) floor($number);
|
return (int) floor($number);
|
||||||
}
|
}
|
||||||
@ -681,12 +686,15 @@ class PHPExcel_Calculation_MathTrig {
|
|||||||
$y = PHPExcel_Calculation_Functions::flattenSingleValue($y);
|
$y = PHPExcel_Calculation_Functions::flattenSingleValue($y);
|
||||||
|
|
||||||
// Validate parameters
|
// Validate parameters
|
||||||
if ($x == 0 && $y <= 0) {
|
if ($x == 0.0 && $y == 0.0) {
|
||||||
|
return PHPExcel_Calculation_Functions::NaN();
|
||||||
|
} elseif ($x == 0.0 && $y < 0.0) {
|
||||||
return PHPExcel_Calculation_Functions::DIV0();
|
return PHPExcel_Calculation_Functions::DIV0();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
return pow($x, $y);
|
$result = pow($x, $y);
|
||||||
|
return (!is_nan($result) && !is_infinite($result)) ? $result : PHPExcel_Calculation_Functions::NaN();
|
||||||
} // function POWER()
|
} // function POWER()
|
||||||
|
|
||||||
|
|
||||||
@ -915,6 +923,8 @@ class PHPExcel_Calculation_MathTrig {
|
|||||||
public static function SIGN($number) {
|
public static function SIGN($number) {
|
||||||
$number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
|
$number = PHPExcel_Calculation_Functions::flattenSingleValue($number);
|
||||||
|
|
||||||
|
if (is_bool($number))
|
||||||
|
return (int) $number;
|
||||||
if (is_numeric($number)) {
|
if (is_numeric($number)) {
|
||||||
if ($number == 0.0) {
|
if ($number == 0.0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -283,7 +283,7 @@ class PHPExcel_Cell
|
|||||||
$result = PHPExcel_Calculation::getInstance()->calculateCellValue($this,$resetLog);
|
$result = PHPExcel_Calculation::getInstance()->calculateCellValue($this,$resetLog);
|
||||||
// echo $this->getCoordinate().' calculation result is '.$result.'<br />';
|
// echo $this->getCoordinate().' calculation result is '.$result.'<br />';
|
||||||
} catch ( Exception $ex ) {
|
} catch ( Exception $ex ) {
|
||||||
if (($ex->getMessage() === 'Unable to access External Workbook') && (!is_null($this->_calculatedValue))) {
|
if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->_calculatedValue !== NULL)) {
|
||||||
// echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().'<br />';
|
// echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().'<br />';
|
||||||
return $this->_calculatedValue; // Fallback for calculations referencing external files.
|
return $this->_calculatedValue; // Fallback for calculations referencing external files.
|
||||||
}
|
}
|
||||||
@ -300,7 +300,7 @@ class PHPExcel_Cell
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (is_null($this->_value)) {
|
// if ($this->_value === NULL) {
|
||||||
// echo 'Cell '.$this->getCoordinate().' has no value, formula or otherwise<br />';
|
// echo 'Cell '.$this->getCoordinate().' has no value, formula or otherwise<br />';
|
||||||
// return null;
|
// return null;
|
||||||
// }
|
// }
|
||||||
@ -813,7 +813,7 @@ class PHPExcel_Cell
|
|||||||
* @return PHPExcel_Cell_IValueBinder
|
* @return PHPExcel_Cell_IValueBinder
|
||||||
*/
|
*/
|
||||||
public static function getValueBinder() {
|
public static function getValueBinder() {
|
||||||
if (is_null(self::$_valueBinder)) {
|
if (self::$_valueBinder === NULL) {
|
||||||
self::$_valueBinder = new PHPExcel_Cell_DefaultValueBinder();
|
self::$_valueBinder = new PHPExcel_Cell_DefaultValueBinder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -827,7 +827,7 @@ class PHPExcel_Cell
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static function setValueBinder(PHPExcel_Cell_IValueBinder $binder = null) {
|
public static function setValueBinder(PHPExcel_Cell_IValueBinder $binder = null) {
|
||||||
if (is_null($binder)) {
|
if ($binder === NULL) {
|
||||||
throw new Exception("A PHPExcel_Cell_IValueBinder is required for PHPExcel to function correctly.");
|
throw new Exception("A PHPExcel_Cell_IValueBinder is required for PHPExcel to function correctly.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class PHPExcel_HashTable
|
|||||||
*/
|
*/
|
||||||
public function __construct($pSource = null)
|
public function __construct($pSource = null)
|
||||||
{
|
{
|
||||||
if (!is_null($pSource)) {
|
if ($pSource !== NULL) {
|
||||||
// Create HashTable
|
// Create HashTable
|
||||||
$this->addFromSource($pSource);
|
$this->addFromSource($pSource);
|
||||||
}
|
}
|
||||||
|
@ -612,7 +612,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
$cellRange = $columnID.$rowID;
|
$cellRange = $columnID.$rowID;
|
||||||
|
|
||||||
if (!is_null($this->getReadFilter())) {
|
if ($this->getReadFilter() !== NULL) {
|
||||||
if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) {
|
if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -493,7 +493,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
if ($xmlStyles && $xmlStyles->numFmts[0]) {
|
if ($xmlStyles && $xmlStyles->numFmts[0]) {
|
||||||
$numFmts = $xmlStyles->numFmts[0];
|
$numFmts = $xmlStyles->numFmts[0];
|
||||||
}
|
}
|
||||||
if (isset($numFmts) && !is_null($numFmts)) {
|
if (isset($numFmts) && ($numFmts !== NULL)) {
|
||||||
$numFmts->registerXPathNamespace("sml", "http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
$numFmts->registerXPathNamespace("sml", "http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||||
}
|
}
|
||||||
if (!$this->_readDataOnly && $xmlStyles) {
|
if (!$this->_readDataOnly && $xmlStyles) {
|
||||||
@ -793,7 +793,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
$calculatedValue = null;
|
$calculatedValue = null;
|
||||||
|
|
||||||
// Read cell?
|
// Read cell?
|
||||||
if (!is_null($this->getReadFilter())) {
|
if ($this->getReadFilter() !== NULL) {
|
||||||
$coordinates = PHPExcel_Cell::coordinateFromString($r);
|
$coordinates = PHPExcel_Cell::coordinateFromString($r);
|
||||||
|
|
||||||
if (!$this->getReadFilter()->readCell($coordinates[0], $coordinates[1], $docSheet->getTitle())) {
|
if (!$this->getReadFilter()->readCell($coordinates[0], $coordinates[1], $docSheet->getTitle())) {
|
||||||
@ -888,7 +888,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
} else {
|
} else {
|
||||||
$cell->setValue($value);
|
$cell->setValue($value);
|
||||||
}
|
}
|
||||||
if (!is_null($calculatedValue)) {
|
if ($calculatedValue !== NULL) {
|
||||||
$cell->setCalculatedValue($calculatedValue);
|
$cell->setCalculatedValue($calculatedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1198,7 +1198,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($column) && !is_null($row)) {
|
if (($column !== NULL) && ($row !== NULL)) {
|
||||||
// Set comment properties
|
// Set comment properties
|
||||||
$comment = $docSheet->getCommentByColumnAndRow($column, $row + 1);
|
$comment = $docSheet->getCommentByColumnAndRow($column, $row + 1);
|
||||||
$comment->getFillColor()->setRGB( $fillColor );
|
$comment->getFillColor()->setRGB( $fillColor );
|
||||||
@ -1501,7 +1501,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
$extractedRange = isset($range[1]) ? $range[1] : $range[0];
|
$extractedRange = isset($range[1]) ? $range[1] : $range[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($locatedSheet)) {
|
if ($locatedSheet !== NULL) {
|
||||||
$excel->addNamedRange( new PHPExcel_NamedRange((string)$definedName['name'], $locatedSheet, $extractedRange, false) );
|
$excel->addNamedRange( new PHPExcel_NamedRange((string)$definedName['name'], $locatedSheet, $extractedRange, false) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1540,7 +1540,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
} else if (isset($color["indexed"])) {
|
} else if (isset($color["indexed"])) {
|
||||||
return PHPExcel_Style_Color::indexedColor($color["indexed"],$background)->getARGB();
|
return PHPExcel_Style_Color::indexedColor($color["indexed"],$background)->getARGB();
|
||||||
} else if (isset($color["theme"])) {
|
} else if (isset($color["theme"])) {
|
||||||
if (!is_null(self::$_theme)) {
|
if (self::$_theme !== NULL) {
|
||||||
$returnColour = self::$_theme->getColourByIndex((int)$color["theme"]);
|
$returnColour = self::$_theme->getColourByIndex((int)$color["theme"]);
|
||||||
if (isset($color["tint"])) {
|
if (isset($color["tint"])) {
|
||||||
$tintAdjust = (float) $color["tint"];
|
$tintAdjust = (float) $color["tint"];
|
||||||
|
@ -942,7 +942,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
if ($this->_version == self::XLS_BIFF8) {
|
if ($this->_version == self::XLS_BIFF8) {
|
||||||
foreach ($this->_sharedFormulaParts as $cell => $baseCell) {
|
foreach ($this->_sharedFormulaParts as $cell => $baseCell) {
|
||||||
list($column, $row) = PHPExcel_Cell::coordinateFromString($cell);
|
list($column, $row) = PHPExcel_Cell::coordinateFromString($cell);
|
||||||
if ( !is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($column, $row, $this->_phpSheet->getTitle()) ) {
|
if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($column, $row, $this->_phpSheet->getTitle()) ) {
|
||||||
$formula = $this->_getFormulaFromStructure($this->_sharedFormulas[$baseCell], $cell);
|
$formula = $this->_getFormulaFromStructure($this->_sharedFormulas[$baseCell], $cell);
|
||||||
$this->_phpSheet->getCell($cell)->setValueExplicit('=' . $formula, PHPExcel_Cell_DataType::TYPE_FORMULA);
|
$this->_phpSheet->getCell($cell)->setValueExplicit('=' . $formula, PHPExcel_Cell_DataType::TYPE_FORMULA);
|
||||||
}
|
}
|
||||||
@ -3307,7 +3307,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$columnString = PHPExcel_Cell::stringFromColumnIndex($column);
|
$columnString = PHPExcel_Cell::stringFromColumnIndex($column);
|
||||||
|
|
||||||
// Read cell?
|
// Read cell?
|
||||||
if ( !is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) {
|
if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) {
|
||||||
// offset: 4; size: 2; index to XF record
|
// offset: 4; size: 2; index to XF record
|
||||||
$xfIndex = self::_GetInt2d($recordData, 4);
|
$xfIndex = self::_GetInt2d($recordData, 4);
|
||||||
|
|
||||||
@ -3351,7 +3351,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$columnString = PHPExcel_Cell::stringFromColumnIndex($column);
|
$columnString = PHPExcel_Cell::stringFromColumnIndex($column);
|
||||||
|
|
||||||
// Read cell?
|
// Read cell?
|
||||||
if ( !is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) {
|
if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) {
|
||||||
// offset: 4; size: 2; index to XF record
|
// offset: 4; size: 2; index to XF record
|
||||||
$xfIndex = self::_GetInt2d($recordData, 4);
|
$xfIndex = self::_GetInt2d($recordData, 4);
|
||||||
|
|
||||||
@ -3437,7 +3437,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$columnString = PHPExcel_Cell::stringFromColumnIndex($colFirst + $i);
|
$columnString = PHPExcel_Cell::stringFromColumnIndex($colFirst + $i);
|
||||||
|
|
||||||
// Read cell?
|
// Read cell?
|
||||||
if ( !is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) {
|
if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) {
|
||||||
|
|
||||||
// offset: var; size: 2; index to XF record
|
// offset: var; size: 2; index to XF record
|
||||||
$xfIndex = self::_GetInt2d($recordData, $offset);
|
$xfIndex = self::_GetInt2d($recordData, $offset);
|
||||||
@ -3482,7 +3482,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$columnString = PHPExcel_Cell::stringFromColumnIndex($column);
|
$columnString = PHPExcel_Cell::stringFromColumnIndex($column);
|
||||||
|
|
||||||
// Read cell?
|
// Read cell?
|
||||||
if ( !is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) {
|
if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) {
|
||||||
// offset 4; size: 2; index to XF record
|
// offset 4; size: 2; index to XF record
|
||||||
$xfIndex = self::_GetInt2d($recordData, 4);
|
$xfIndex = self::_GetInt2d($recordData, 4);
|
||||||
|
|
||||||
@ -3548,7 +3548,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read cell?
|
// Read cell?
|
||||||
if ( !is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) {
|
if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) {
|
||||||
|
|
||||||
if ($isPartOfSharedFormula) {
|
if ($isPartOfSharedFormula) {
|
||||||
// formula is added to this cell after the sheet has been read
|
// formula is added to this cell after the sheet has been read
|
||||||
@ -3722,7 +3722,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$columnString = PHPExcel_Cell::stringFromColumnIndex($column);
|
$columnString = PHPExcel_Cell::stringFromColumnIndex($column);
|
||||||
|
|
||||||
// Read cell?
|
// Read cell?
|
||||||
if ( !is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) {
|
if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) {
|
||||||
// offset: 4; size: 2; index to XF record
|
// offset: 4; size: 2; index to XF record
|
||||||
$xfIndex = self::_GetInt2d($recordData, 4);
|
$xfIndex = self::_GetInt2d($recordData, 4);
|
||||||
|
|
||||||
@ -3785,7 +3785,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$columnString = PHPExcel_Cell::stringFromColumnIndex($fc + $i);
|
$columnString = PHPExcel_Cell::stringFromColumnIndex($fc + $i);
|
||||||
|
|
||||||
// Read cell?
|
// Read cell?
|
||||||
if ( !is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) {
|
if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) {
|
||||||
$xfIndex = self::_GetInt2d($recordData, 4 + 2 * $i);
|
$xfIndex = self::_GetInt2d($recordData, 4 + 2 * $i);
|
||||||
$this->_phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfIndex]);
|
$this->_phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfIndex]);
|
||||||
}
|
}
|
||||||
@ -3821,7 +3821,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$columnString = PHPExcel_Cell::stringFromColumnIndex($column);
|
$columnString = PHPExcel_Cell::stringFromColumnIndex($column);
|
||||||
|
|
||||||
// Read cell?
|
// Read cell?
|
||||||
if ( !is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) {
|
if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) {
|
||||||
// offset: 4; size: 2; XF index
|
// offset: 4; size: 2; XF index
|
||||||
$xfIndex = self::_GetInt2d($recordData, 4);
|
$xfIndex = self::_GetInt2d($recordData, 4);
|
||||||
|
|
||||||
@ -3863,7 +3863,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$columnString = PHPExcel_Cell::stringFromColumnIndex($col);
|
$columnString = PHPExcel_Cell::stringFromColumnIndex($col);
|
||||||
|
|
||||||
// Read cell?
|
// Read cell?
|
||||||
if ( !is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) {
|
if (($this->getReadFilter() !== NULL) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle()) ) {
|
||||||
// offset: 4; size: 2; XF index
|
// offset: 4; size: 2; XF index
|
||||||
$xfIndex = self::_GetInt2d($recordData, 4);
|
$xfIndex = self::_GetInt2d($recordData, 4);
|
||||||
|
|
||||||
@ -4069,7 +4069,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
private function _includeCellRangeFiltered($cellRangeAddress)
|
private function _includeCellRangeFiltered($cellRangeAddress)
|
||||||
{
|
{
|
||||||
$includeCellRange = true;
|
$includeCellRange = true;
|
||||||
if (!is_null($this->getReadFilter())) {
|
if ($this->getReadFilter() !== NULL) {
|
||||||
$includeCellRange = false;
|
$includeCellRange = false;
|
||||||
$rangeBoundaries = PHPExcel_Cell::getRangeBoundaries($cellRangeAddress);
|
$rangeBoundaries = PHPExcel_Cell::getRangeBoundaries($cellRangeAddress);
|
||||||
$rangeBoundaries[1][0]++;
|
$rangeBoundaries[1][0]++;
|
||||||
|
@ -464,7 +464,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
$column = PHPExcel_Cell::stringFromColumnIndex($column);
|
$column = PHPExcel_Cell::stringFromColumnIndex($column);
|
||||||
|
|
||||||
// Read cell?
|
// Read cell?
|
||||||
if (!is_null($this->getReadFilter())) {
|
if ($this->getReadFilter() !== NULL) {
|
||||||
if (!$this->getReadFilter()->readCell($column, $row, $worksheetName)) {
|
if (!$this->getReadFilter()->readCell($column, $row, $worksheetName)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -414,7 +414,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
case 'table-row' :
|
case 'table-row' :
|
||||||
$columnID = 'A';
|
$columnID = 'A';
|
||||||
foreach($rowData as $key => $cellData) {
|
foreach($rowData as $key => $cellData) {
|
||||||
if (!is_null($this->getReadFilter())) {
|
if ($this->getReadFilter() !== NULL) {
|
||||||
if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) {
|
if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ class PHPExcel_ReferenceHelper
|
|||||||
* @return PHPExcel_ReferenceHelper
|
* @return PHPExcel_ReferenceHelper
|
||||||
*/
|
*/
|
||||||
public static function getInstance() {
|
public static function getInstance() {
|
||||||
if (!isset(self::$_instance) || is_null(self::$_instance)) {
|
if (!isset(self::$_instance) || (self::$_instance === NULL)) {
|
||||||
self::$_instance = new PHPExcel_ReferenceHelper();
|
self::$_instance = new PHPExcel_ReferenceHelper();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -530,7 +530,7 @@ class PHPExcel_ReferenceHelper
|
|||||||
foreach ($pPhpExcel->getWorksheetIterator() as $sheet) {
|
foreach ($pPhpExcel->getWorksheetIterator() as $sheet) {
|
||||||
foreach ($sheet->getCellCollection(false) as $cellID) {
|
foreach ($sheet->getCellCollection(false) as $cellID) {
|
||||||
$cell = $sheet->getCell($cellID);
|
$cell = $sheet->getCell($cellID);
|
||||||
if (!is_null($cell) && $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
|
if (($cell !== NULL) && ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA)) {
|
||||||
$formula = $cell->getValue();
|
$formula = $cell->getValue();
|
||||||
if (strpos($formula, $oldName) !== false) {
|
if (strpos($formula, $oldName) !== false) {
|
||||||
$formula = str_replace("'" . $oldName . "'!", "'" . $newName . "'!", $formula);
|
$formula = str_replace("'" . $oldName . "'!", "'" . $newName . "'!", $formula);
|
||||||
|
@ -703,4 +703,18 @@ class PHPExcel_Shared_String
|
|||||||
return $pValue;
|
return $pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve any leading numeric part of a string, or return the full string if no leading numeric
|
||||||
|
* (handles basic integer or float, but not exponent or non decimal)
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
* @return mixed string or only the leading numeric part of the string
|
||||||
|
*/
|
||||||
|
public static function testStringAsNumeric($value)
|
||||||
|
{
|
||||||
|
if (is_numeric($value))
|
||||||
|
return $value;
|
||||||
|
$v = floatval($value);
|
||||||
|
return (is_numeric(substr($value,0,strlen($v)))) ? $v : $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -421,7 +421,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
// Re-order cell collection
|
// Re-order cell collection
|
||||||
return $this->sortCellCollection();
|
return $this->sortCellCollection();
|
||||||
}
|
}
|
||||||
if (!is_null($this->_cellCollection)) {
|
if ($this->_cellCollection !== NULL) {
|
||||||
return $this->_cellCollection->getCellList();
|
return $this->_cellCollection->getCellList();
|
||||||
}
|
}
|
||||||
return array();
|
return array();
|
||||||
@ -434,7 +434,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
*/
|
*/
|
||||||
public function sortCellCollection()
|
public function sortCellCollection()
|
||||||
{
|
{
|
||||||
if (!is_null($this->_cellCollection)) {
|
if ($this->_cellCollection !== NULL) {
|
||||||
return $this->_cellCollection->getSortedCellList();
|
return $this->_cellCollection->getSortedCellList();
|
||||||
}
|
}
|
||||||
return array();
|
return array();
|
||||||
@ -984,7 +984,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) &&
|
if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) &&
|
||||||
(preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) {
|
(preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) {
|
||||||
$namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this);
|
$namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this);
|
||||||
if (!is_null($namedRange)) {
|
if ($namedRange !== NULL) {
|
||||||
$pCoordinate = $namedRange->getRange();
|
$pCoordinate = $namedRange->getRange();
|
||||||
return $namedRange->getWorksheet()->getCell($pCoordinate);
|
return $namedRange->getWorksheet()->getCell($pCoordinate);
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
*/
|
*/
|
||||||
private function _mapBorderStyle($borderStyle) {
|
private function _mapBorderStyle($borderStyle) {
|
||||||
switch ($borderStyle) {
|
switch ($borderStyle) {
|
||||||
case PHPExcel_Style_Border::BORDER_NONE: return '0px';
|
case PHPExcel_Style_Border::BORDER_NONE: return '1px hidden';
|
||||||
case PHPExcel_Style_Border::BORDER_DASHDOT: return '1px dashed';
|
case PHPExcel_Style_Border::BORDER_DASHDOT: return '1px dashed';
|
||||||
case PHPExcel_Style_Border::BORDER_DASHDOTDOT: return '1px dotted';
|
case PHPExcel_Style_Border::BORDER_DASHDOTDOT: return '1px dotted';
|
||||||
case PHPExcel_Style_Border::BORDER_DASHED: return '1px dashed';
|
case PHPExcel_Style_Border::BORDER_DASHED: return '1px dashed';
|
||||||
@ -839,11 +839,8 @@ class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function _createCSSStyleBorder(PHPExcel_Style_Border $pStyle) {
|
private function _createCSSStyleBorder(PHPExcel_Style_Border $pStyle) {
|
||||||
// Construct HTML
|
|
||||||
$css = '';
|
|
||||||
|
|
||||||
// Create CSS
|
// Create CSS
|
||||||
$css .= $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB();
|
$css = $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB();
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
return $css;
|
return $css;
|
||||||
|
Loading…
Reference in New Issue
Block a user