Minor performance tweaks

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@64389 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2010-11-26 13:31:51 +00:00
parent fcf2643609
commit 506eabdbf7
3 changed files with 10 additions and 7 deletions

View File

@ -3517,7 +3517,8 @@ class PHPExcel_Calculation {
// Extract range
$aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange);
$pRange = $pSheet->getTitle().'!'.$pRange;
if (count($aReferences) == 1) {
if (!isset($aReferences[1])) {
// Single cell in range
list($currentCol,$currentRow) = sscanf($aReferences[0],'%[A-Z]%d');
if ($pSheet->cellExists($aReferences[0])) {
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
@ -3525,7 +3526,7 @@ class PHPExcel_Calculation {
$returnValue[$currentRow][$currentCol] = null;
}
} else {
// Extract cell data
// Extract cell data for all cells in the range
foreach ($aReferences as $reference) {
// Extract range
list($currentCol,$currentRow) = sscanf($reference,'%[A-Z]%d');
@ -3589,7 +3590,8 @@ class PHPExcel_Calculation {
// Extract range
$aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange);
if (count($aReferences) == 1) {
if (!isset($aReferences[1])) {
// Single cell in range
list($currentCol,$currentRow) = PHPExcel_Cell::coordinateFromString($aReferences[0]);
if ($pSheet->cellExists($aReferences[0])) {
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
@ -3597,7 +3599,7 @@ class PHPExcel_Calculation {
$returnValue[$currentRow][$currentCol] = null;
}
} else {
// Extract cell data
// Extract cell data for all cells in the range
foreach ($aReferences as $reference) {
// Extract range
list($currentCol,$currentRow) = PHPExcel_Cell::coordinateFromString($reference);

View File

@ -172,7 +172,7 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter
* @param string $pPartName Writer part name
* @return PHPExcel_Writer_Excel2007_WriterPart
*/
function getWriterPart($pPartName = '') {
public function getWriterPart($pPartName = '') {
if ($pPartName != '' && isset($this->_writerParts[strtolower($pPartName)])) {
return $this->_writerParts[strtolower($pPartName)];
} else {
@ -363,7 +363,7 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter
* @throws Exception
*/
public function getPHPExcel() {
if ($this->_spreadSheet !== NULL) {
if ($this->_spreadSheet !== null) {
return $this->_spreadSheet;
} else {
throw new Exception("No PHPExcel assigned.");

View File

@ -858,7 +858,8 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$cellsByRow[$cellAddress[1]][] = $cellID;
}
for ($currentRow = 1; $currentRow <= $highestRow; ++$currentRow) {
$currentRow = 0;
while($currentRow++ < $highestRow) {
// Get row dimension
$rowDimension = $pSheet->getRowDimension($currentRow);