Bugfix: Work item 16956 - External links in Excel2010 files cause Fatal error

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@83262 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2011-11-25 14:30:02 +00:00
parent f2076cde3f
commit 6e7b84ef97
1 changed files with 4 additions and 0 deletions

View File

@ -283,6 +283,10 @@ class PHPExcel_Cell
$result = PHPExcel_Calculation::getInstance()->calculateCellValue($this,$resetLog);
// echo $this->getCoordinate().' calculation result is '.$result.'<br />';
} catch ( Exception $ex ) {
if (($ex->getMessage() === 'Unable to access External Workbook') && (!is_null($this->_calculatedValue))) {
// echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().'<br />';
return $this->_calculatedValue; // Fallback for calculations referencing external files.
}
// echo 'Calculation Exception: '.$ex->getMessage().'<br />';
$result = '#N/A';
throw(new Exception($this->getParent()->getTitle().'!'.$this->getCoordinate().' -> '.$ex->getMessage()));