Bugfix: Work item 15409 - Full column/row references in named ranges not supported by updateCellReference()
git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@69495 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
parent
51b3f847fb
commit
aedff36d4e
|
@ -3652,9 +3652,17 @@ class PHPExcel_Calculation {
|
||||||
$namedRange = PHPExcel_NamedRange::resolveRange($pRange, $pSheet);
|
$namedRange = PHPExcel_NamedRange::resolveRange($pRange, $pSheet);
|
||||||
if (!is_null($namedRange)) {
|
if (!is_null($namedRange)) {
|
||||||
$pSheet = $namedRange->getWorksheet();
|
$pSheet = $namedRange->getWorksheet();
|
||||||
//// echo 'Named Range '.$pRange.' (';
|
// echo 'Named Range '.$pRange.' (';
|
||||||
$pRange = $namedRange->getRange();
|
$pRange = $namedRange->getRange();
|
||||||
//// echo $pRange.') is in sheet '.$namedRange->getWorksheet()->getTitle().'<br />';
|
$splitRange = PHPExcel_Cell::splitRange($pRange);
|
||||||
|
// Convert row and column references
|
||||||
|
if (ctype_alpha($splitRange[0][0])) {
|
||||||
|
$pRange = $splitRange[0][0] . '1:' . $splitRange[0][1] . $namedRange->getWorksheet()->getHighestRow();
|
||||||
|
} elseif(ctype_digit($splitRange[0][0])) {
|
||||||
|
$pRange = 'A' . $splitRange[0][0] . ':' . $namedRange->getWorksheet()->getHighestColumn() . $splitRange[0][1];
|
||||||
|
}
|
||||||
|
// echo $pRange.') is in sheet '.$namedRange->getWorksheet()->getTitle().'<br />';
|
||||||
|
|
||||||
// if ($pSheet->getTitle() != $namedRange->getWorksheet()->getTitle()) {
|
// if ($pSheet->getTitle() != $namedRange->getWorksheet()->getTitle()) {
|
||||||
// if (!$namedRange->getLocalOnly()) {
|
// if (!$namedRange->getLocalOnly()) {
|
||||||
// $pSheet = $namedRange->getWorksheet();
|
// $pSheet = $namedRange->getWorksheet();
|
||||||
|
@ -3668,8 +3676,9 @@ class PHPExcel_Calculation {
|
||||||
|
|
||||||
// Extract range
|
// Extract range
|
||||||
$aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange);
|
$aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange);
|
||||||
|
// var_dump($aReferences);
|
||||||
if (!isset($aReferences[1])) {
|
if (!isset($aReferences[1])) {
|
||||||
// Single cell in range
|
// Single cell (or single column or row) in range
|
||||||
list($currentCol,$currentRow) = PHPExcel_Cell::coordinateFromString($aReferences[0]);
|
list($currentCol,$currentRow) = PHPExcel_Cell::coordinateFromString($aReferences[0]);
|
||||||
if ($pSheet->cellExists($aReferences[0])) {
|
if ($pSheet->cellExists($aReferences[0])) {
|
||||||
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
|
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
|
||||||
|
|
|
@ -545,7 +545,7 @@ class PHPExcel_ReferenceHelper
|
||||||
/**
|
/**
|
||||||
* Update cell range
|
* Update cell range
|
||||||
*
|
*
|
||||||
* @param string $pCellRange Cell range
|
* @param string $pCellRange Cell range (e.g. 'B2:D4', 'B:C' or '2:3')
|
||||||
* @param int $pBefore Insert before this one
|
* @param int $pBefore Insert before this one
|
||||||
* @param int $pNumCols Number of columns to increment
|
* @param int $pNumCols Number of columns to increment
|
||||||
* @param int $pNumRows Number of rows to increment
|
* @param int $pNumRows Number of rows to increment
|
||||||
|
@ -560,7 +560,15 @@ class PHPExcel_ReferenceHelper
|
||||||
for ($i = 0; $i < $ic; ++$i) {
|
for ($i = 0; $i < $ic; ++$i) {
|
||||||
$jc = count($range[$i]);
|
$jc = count($range[$i]);
|
||||||
for ($j = 0; $j < $jc; ++$j) {
|
for ($j = 0; $j < $jc; ++$j) {
|
||||||
$range[$i][$j] = $this->_updateSingleCellReference($range[$i][$j], $pBefore, $pNumCols, $pNumRows);
|
if (ctype_alpha($range[$i][$j])) {
|
||||||
|
$r = PHPExcel_Cell::coordinateFromString($this->_updateSingleCellReference($range[$i][$j].'1', $pBefore, $pNumCols, $pNumRows));
|
||||||
|
$range[$i][$j] = $r[0];
|
||||||
|
} elseif(ctype_digit($range[$i][$j])) {
|
||||||
|
$r = PHPExcel_Cell::coordinateFromString($this->_updateSingleCellReference('A'.$range[$i][$j], $pBefore, $pNumCols, $pNumRows));
|
||||||
|
$range[$i][$j] = $r[1];
|
||||||
|
} else {
|
||||||
|
$range[$i][$j] = $this->_updateSingleCellReference($range[$i][$j], $pBefore, $pNumCols, $pNumRows);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -321,9 +321,9 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
||||||
// Create absolute coordinate and write as raw text
|
// Create absolute coordinate and write as raw text
|
||||||
$range = PHPExcel_Cell::splitRange($pNamedRange->getRange());
|
$range = PHPExcel_Cell::splitRange($pNamedRange->getRange());
|
||||||
for ($i = 0; $i < count($range); $i++) {
|
for ($i = 0; $i < count($range); $i++) {
|
||||||
$range[$i][0] = '\'' . str_replace("'", "''", $pNamedRange->getWorksheet()->getTitle()) . '\'!' . PHPExcel_Cell::absoluteCoordinate($range[$i][0]);
|
$range[$i][0] = '\'' . str_replace("'", "''", $pNamedRange->getWorksheet()->getTitle()) . '\'!' . PHPExcel_Cell::absoluteReference($range[$i][0]);
|
||||||
if (isset($range[$i][1])) {
|
if (isset($range[$i][1])) {
|
||||||
$range[$i][1] = PHPExcel_Cell::absoluteCoordinate($range[$i][1]);
|
$range[$i][1] = PHPExcel_Cell::absoluteReference($range[$i][1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$range = PHPExcel_Cell::buildRange($range);
|
$range = PHPExcel_Cell::buildRange($range);
|
||||||
|
|
|
@ -68,6 +68,7 @@ Fixed in SVN:
|
||||||
- Bugfix: (MBaker) Work item 15096 - insertNewRowBefore fails to consistently update references
|
- Bugfix: (MBaker) Work item 15096 - insertNewRowBefore fails to consistently update references
|
||||||
- Bugfix: (MBaker) "i" is not a valid character for Excel date format masks (in isDateTimeFormatCode() method)
|
- Bugfix: (MBaker) "i" is not a valid character for Excel date format masks (in isDateTimeFormatCode() method)
|
||||||
- Bugfix: (MKunert) Work item 15421 - PHPExcel_ReferenceHelper::insertNewBefore() is missing an 'Update worksheet: comments' section
|
- Bugfix: (MKunert) Work item 15421 - PHPExcel_ReferenceHelper::insertNewBefore() is missing an 'Update worksheet: comments' section
|
||||||
|
- Bugfix: (MBaker) Work item 15409 - Full column/row references in named ranges not supported by updateCellReference()
|
||||||
- General: (MBaker) Improved performance (speed), for building the Shared Strings table in the Excel2007 Writer.
|
- General: (MBaker) Improved performance (speed), for building the Shared Strings table in the Excel2007 Writer.
|
||||||
- General: (MBaker) Improved performance (speed), for PHP to Excel date conversions
|
- General: (MBaker) Improved performance (speed), for PHP to Excel date conversions
|
||||||
- General: (MBaker) Enhanced SheetViews element structures in the Excel2007 Writer for frozen panes.
|
- General: (MBaker) Enhanced SheetViews element structures in the Excel2007 Writer for frozen panes.
|
||||||
|
|
Loading…
Reference in New Issue