Minor bugfixes

This commit is contained in:
Mark Baker 2012-09-16 23:28:03 +01:00
parent 48c263d63b
commit fb6ad92fd4
3 changed files with 20 additions and 8 deletions

View File

@ -3085,7 +3085,12 @@ class PHPExcel_Calculation {
} }
$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 ($pCellParent !== NULL) { 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 { } else {
return $this->_raiseFormulaError('Unable to access Cell Reference'); return $this->_raiseFormulaError('Unable to access Cell Reference');
} }
@ -3205,7 +3210,12 @@ class PHPExcel_Calculation {
// 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 ($pCellParent !== NULL) { 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 { } else {
return $this->_raiseFormulaError('Unable to access Cell Reference'); return $this->_raiseFormulaError('Unable to access Cell Reference');
} }
@ -3238,11 +3248,12 @@ 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 ($pCellParent !== NULL) { if ($pCellParent !== NULL) {
if ($pCellParent->getParent()->getSheetByName($matches[2])->cellExists($cellRef)) { $referencedWorksheet = $pCellParent->getParent()->getSheetByName($matches[2]);
$cellValue = $this->extractCellRange($cellRef, $pCellParent->getParent()->getSheetByName($matches[2]), false); if (($referencedWorksheet) && ($referencedWorksheet->cellExists($cellRef))) {
$cellValue = $this->extractCellRange($cellRef, $referencedWorksheet, false);
$pCell->attach($pCellParent); $pCell->attach($pCellParent);
} else { } else {
$cellValue = null; $cellValue = NULL;
} }
} else { } else {
return $this->_raiseFormulaError('Unable to access Cell Reference'); return $this->_raiseFormulaError('Unable to access Cell Reference');
@ -3631,7 +3642,7 @@ class PHPExcel_Calculation {
if (!isset($aReferences[1])) { if (!isset($aReferences[1])) {
// Single cell in range // Single cell in range
list($currentCol,$currentRow) = sscanf($aReferences[0],'%[A-Z]%d'); 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); $returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
} else { } else {
$returnValue[$currentRow][$currentCol] = null; $returnValue[$currentRow][$currentCol] = null;
@ -3642,7 +3653,7 @@ class PHPExcel_Calculation {
// Extract range // Extract range
list($currentCol,$currentRow) = sscanf($reference,'%[A-Z]%d'); 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); $returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog);
} else { } else {
$returnValue[$currentRow][$currentCol] = null; $returnValue[$currentRow][$currentCol] = null;

View File

@ -49,7 +49,7 @@ if (!file_exists("33chartcreate-bar.xlsx")) {
echo date('H:i:s') , " Load from Excel2007 file" , EOL; echo date('H:i:s') , " Load from Excel2007 file" , EOL;
$objReader = PHPExcel_IOFactory::createReader("Excel2007"); $objReader = PHPExcel_IOFactory::createReader("Excel2007");
$objReader->setIncludeCharts(TRUE); $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; echo date('H:i:s') , " Update cell data values that are displayed in the chart" , EOL;

View File

@ -84,6 +84,7 @@ Fixed in develop branch:
- Feature: (MBaker) Excel compatibility option added for writing CSV files - 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. 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. 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: (alexgann) Add Currency detection to the Advanced Value Binder
- General: (MBaker) Work item 18404 - setCellValueExplicitByColumnAndRow() do not return PHPExcel_Worksheet - 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 - General: (MBaker) Work item 18324 - Reader factory doesn't read anymore XLTX and XLT files