You are here

public function PHPExcel_Calculation::calculateFormula in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation.php \PHPExcel_Calculation::calculateFormula()

* Calculate the value of a formula * *

Parameters

string $formula Formula to parse: * @param string $cellID Address of the cell to calculate * @param PHPExcel_Cell $pCell Cell to calculate * @return mixed * @throws PHPExcel_Calculation_Exception

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation.php, line 2323

Class

PHPExcel_Calculation
PHPExcel_Calculation (Multiton)

Code

public function calculateFormula($formula, $cellID = NULL, PHPExcel_Cell $pCell = NULL) {

  //	Initialise the logging settings
  $this->formulaError = null;
  $this->_debugLog
    ->clearLog();
  $this->_cyclicReferenceStack
    ->clear();

  //	Disable calculation cacheing because it only applies to cell calculations, not straight formulae
  //	But don't actually flush any cache
  $resetCache = $this
    ->getCalculationCacheEnabled();
  $this->_calculationCacheEnabled = FALSE;

  //	Execute the calculation
  try {
    $result = self::_unwrapResult($this
      ->_calculateFormulaValue($formula, $cellID, $pCell));
  } catch (PHPExcel_Exception $e) {
    throw new PHPExcel_Calculation_Exception($e
      ->getMessage());
  }

  //	Reset calculation cacheing to its previous state
  $this->_calculationCacheEnabled = $resetCache;
  return $result;
}