diff --git a/Classes/PHPExcel/Calculation.php b/Classes/PHPExcel/Calculation.php index f71271ed..5de4bb2b 100644 --- a/Classes/PHPExcel/Calculation.php +++ b/Classes/PHPExcel/Calculation.php @@ -3085,7 +3085,12 @@ class PHPExcel_Calculation { } $cellRef = PHPExcel_Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.PHPExcel_Cell::stringFromColumnIndex(max($oCol)).max($oRow); if ($pCellParent !== NULL) { - $cellValue = $this->extractCellRange($cellRef, $pCellParent->getParent()->getSheetByName($sheet1), false); + $referencedWorksheet = $pCellParent->getParent()->getSheetByName($sheet1); + if ($referencedWorksheet) { + $cellValue = $this->extractCellRange($cellRef, $referencedWorksheet, false); + } else { + return $this->_raiseFormulaError('Unable to access Cell Reference'); + } } else { return $this->_raiseFormulaError('Unable to access Cell Reference'); } @@ -3205,7 +3210,12 @@ class PHPExcel_Calculation { // echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'
'; $this->_writeDebug('Evaluating Cell Range '.$cellRef.' in worksheet '.$matches[2]); if ($pCellParent !== NULL) { - $cellValue = $this->extractCellRange($cellRef, $pCellParent->getParent()->getSheetByName($matches[2]), false); + $referencedWorksheet = $pCellParent->getParent()->getSheetByName($matches[2]); + if ($referencedWorksheet) { + $cellValue = $this->extractCellRange($cellRef, $pCellParent->getParent()->getSheetByName($matches[2]), false); + } else { + return $this->_raiseFormulaError('Unable to access Cell Reference'); + } } else { return $this->_raiseFormulaError('Unable to access Cell Reference'); } @@ -3238,11 +3248,12 @@ class PHPExcel_Calculation { // echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'
'; $this->_writeDebug('Evaluating Cell '.$cellRef.' in worksheet '.$matches[2]); if ($pCellParent !== NULL) { - if ($pCellParent->getParent()->getSheetByName($matches[2])->cellExists($cellRef)) { - $cellValue = $this->extractCellRange($cellRef, $pCellParent->getParent()->getSheetByName($matches[2]), false); + $referencedWorksheet = $pCellParent->getParent()->getSheetByName($matches[2]); + if (($referencedWorksheet) && ($referencedWorksheet->cellExists($cellRef))) { + $cellValue = $this->extractCellRange($cellRef, $referencedWorksheet, false); $pCell->attach($pCellParent); } else { - $cellValue = null; + $cellValue = NULL; } } else { return $this->_raiseFormulaError('Unable to access Cell Reference'); @@ -3631,7 +3642,7 @@ class PHPExcel_Calculation { if (!isset($aReferences[1])) { // Single cell in range list($currentCol,$currentRow) = sscanf($aReferences[0],'%[A-Z]%d'); - if ($pSheet->cellExists($aReferences[0])) { + if ($pSheet && $pSheet->cellExists($aReferences[0])) { $returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog); } else { $returnValue[$currentRow][$currentCol] = null; @@ -3642,7 +3653,7 @@ class PHPExcel_Calculation { // Extract range list($currentCol,$currentRow) = sscanf($reference,'%[A-Z]%d'); - if ($pSheet->cellExists($reference)) { + if ($pSheet && $pSheet->cellExists($reference)) { $returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog); } else { $returnValue[$currentRow][$currentCol] = null; diff --git a/Tests/34chartupdate.php b/Tests/34chartupdate.php index 46c73afc..c6021723 100644 --- a/Tests/34chartupdate.php +++ b/Tests/34chartupdate.php @@ -49,7 +49,7 @@ if (!file_exists("33chartcreate-bar.xlsx")) { echo date('H:i:s') , " Load from Excel2007 file" , EOL; $objReader = PHPExcel_IOFactory::createReader("Excel2007"); $objReader->setIncludeCharts(TRUE); -$objPHPExcel = $objReader->load("33chartcreate.xlsx"); +$objPHPExcel = $objReader->load("33chartcreate-bar.xlsx"); echo date('H:i:s') , " Update cell data values that are displayed in the chart" , EOL; diff --git a/changelog.txt b/changelog.txt index 76adc2a8..fbcecf99 100644 --- a/changelog.txt +++ b/changelog.txt @@ -84,6 +84,7 @@ Fixed in develop branch: - Feature: (MBaker) Excel compatibility option added for writing CSV files While Excel 2010 can read CSV files with a simple UTF-8 BOM, Excel2007 and earlier require UTF-16LE encoded tab-separated files. The new setExcelCompatibility(TRUE) option for the CSV Writer will generate files with this formatting for easy import into Excel2007 and below. +- Feature: (MBaker) Language implementations for Turkish (tr) - General: (alexgann) Add Currency detection to the Advanced Value Binder - General: (MBaker) Work item 18404 - setCellValueExplicitByColumnAndRow() do not return PHPExcel_Worksheet - General: (MBaker) Work item 18324 - Reader factory doesn't read anymore XLTX and XLT files