This commit is contained in:
Dominik Bonsch 2013-02-09 12:15:01 +01:00
parent 086d12e7af
commit caced1a5be
1 changed files with 2680 additions and 2652 deletions

View File

@ -376,7 +376,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* typically so that the worksheet object can be unset * typically so that the worksheet object can be unset
* *
*/ */
public function disconnectCells() { public function disconnectCells()
{
$this->_cellCollection->unsetWorksheetCells(); $this->_cellCollection->unsetWorksheetCells();
$this->_cellCollection = null; $this->_cellCollection = null;
@ -389,7 +390,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* *
* @return PHPExcel_CachedObjectStorage_xxx * @return PHPExcel_CachedObjectStorage_xxx
*/ */
public function getCellCacheController() { public function getCellCacheController()
{
return $this->_cellCollection; return $this->_cellCollection;
} // function getCellCacheController() } // function getCellCacheController()
@ -733,7 +735,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* *
* @return PHPExcel * @return PHPExcel
*/ */
public function getParent() { public function getParent()
{
return $this->_parent; return $this->_parent;
} }
@ -743,7 +746,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* @param PHPExcel $parent * @param PHPExcel $parent
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
*/ */
public function rebindParent(PHPExcel $parent) { public function rebindParent(PHPExcel $parent)
{
$namedRanges = $this->_parent->getNamedRanges(); $namedRanges = $this->_parent->getNamedRanges();
foreach ($namedRanges as $namedRange) { foreach ($namedRanges as $namedRange) {
$parent->addNamedRange($namedRange); $parent->addNamedRange($namedRange);
@ -776,6 +780,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* This should be left as the default true, unless you are * This should be left as the default true, unless you are
* certain that no formula cells on any worksheet contain * certain that no formula cells on any worksheet contain
* references to this worksheet * references to this worksheet
*
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
*/ */
public function setTitle($pValue = 'Worksheet', $updateFormulaCellReferences = true) public function setTitle($pValue = 'Worksheet', $updateFormulaCellReferences = true)
@ -837,7 +842,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* *
* @return string Sheet state (visible, hidden, veryHidden) * @return string Sheet state (visible, hidden, veryHidden)
*/ */
public function getSheetState() { public function getSheetState()
{
return $this->_sheetState; return $this->_sheetState;
} }
@ -847,7 +853,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* @param string $value Sheet state (visible, hidden, veryHidden) * @param string $value Sheet state (visible, hidden, veryHidden)
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
*/ */
public function setSheetState($value = PHPExcel_Worksheet::SHEETSTATE_VISIBLE) { public function setSheetState($value = PHPExcel_Worksheet::SHEETSTATE_VISIBLE)
{
$this->_sheetState = $value; $this->_sheetState = $value;
return $this; return $this;
} }
@ -1504,7 +1511,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* *
* Please note that this will overwrite existing cell styles for cells in range! * Please note that this will overwrite existing cell styles for cells in range!
* *
* @param array of PHPExcel_Style_Conditional $pCellStyle Cell style to duplicate * @param [PHPExcel_Style_Conditional] $pCellStyle Cell style to duplicate
* @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
@ -2161,7 +2168,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
/** /**
* Set comments array for the entire sheet. * Set comments array for the entire sheet.
* *
* @param array of PHPExcel_Comment * @param [PHPExcel_Comment] $pValue
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
*/ */
public function setComments($pValue = array()) public function setComments($pValue = array())
@ -2379,7 +2386,10 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* True - Return rows and columns indexed by their actual row and column IDs * True - Return rows and columns indexed by their actual row and column IDs
* @return array * @return array
*/ */
public function rangeToArray($pRange = 'A1', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) { public function rangeToArray(
$pRange = 'A1', $nullValue = null, $calculateFormulas = true,
$formatData = true, $returnCellRef = false)
{
// Returnvalue // Returnvalue
$returnValue = array(); $returnValue = array();
// Identify the range that we need to extract from the worksheet // Identify the range that we need to extract from the worksheet
@ -2416,7 +2426,9 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
if ($formatData) { if ($formatData) {
$style = $this->_parent->getCellXfByIndex($cell->getXfIndex()); $style = $this->_parent->getCellXfByIndex($cell->getXfIndex());
$returnValue[$rRef][$cRef] = PHPExcel_Style_NumberFormat::toFormattedString($returnValue[$rRef][$cRef], $style->getNumberFormat()->getFormatCode()); $returnValue[$rRef][$cRef] = PHPExcel_Style_NumberFormat::toFormattedString(
$returnValue[$rRef][$cRef], $style->getNumberFormat()->getFormatCode()
);
} }
} else { } else {
// Cell holds a NULL // Cell holds a NULL
@ -2446,14 +2458,20 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* @return array * @return array
* @throws PHPExcel_Exception * @throws PHPExcel_Exception
*/ */
public function namedRangeToArray($pNamedRange = '', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) { public function namedRangeToArray(
$pNamedRange = '', $nullValue = null, $calculateFormulas = true,
$formatData = true, $returnCellRef = false
)
{
$namedRange = PHPExcel_NamedRange::resolveRange($pNamedRange, $this); $namedRange = PHPExcel_NamedRange::resolveRange($pNamedRange, $this);
if ($namedRange !== NULL) { if ($namedRange !== NULL) {
$pWorkSheet = $namedRange->getWorksheet(); $pWorkSheet = $namedRange->getWorksheet();
$pCellRange = $namedRange->getRange(); $pCellRange = $namedRange->getRange();
return $pWorkSheet->rangeToArray( $pCellRange, return $pWorkSheet->rangeToArray(
$nullValue, $calculateFormulas, $formatData, $returnCellRef); $pCellRange,
$nullValue, $calculateFormulas, $formatData, $returnCellRef
);
} }
throw new PHPExcel_Exception('Named Range '.$pNamedRange.' does not exist.'); throw new PHPExcel_Exception('Named Range '.$pNamedRange.' does not exist.');
@ -2470,7 +2488,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* True - Return rows and columns indexed by their actual row and column IDs * True - Return rows and columns indexed by their actual row and column IDs
* @return array * @return array
*/ */
public function toArray($nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) { public function toArray($nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false)
{
// Garbage collect... // Garbage collect...
$this->garbageCollect(); $this->garbageCollect();
@ -2478,8 +2497,10 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
$maxCol = $this->getHighestColumn(); $maxCol = $this->getHighestColumn();
$maxRow = $this->getHighestRow(); $maxRow = $this->getHighestRow();
// Return // Return
return $this->rangeToArray( 'A1:'.$maxCol.$maxRow, return $this->rangeToArray(
$nullValue, $calculateFormulas, $formatData, $returnCellRef); 'A1:'.$maxCol.$maxRow,
$nullValue, $calculateFormulas, $formatData, $returnCellRef
);
} }
/** /**
@ -2488,7 +2509,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* @param integer $startRow The row number at which to start iterating * @param integer $startRow The row number at which to start iterating
* @return PHPExcel_Worksheet_RowIterator * @return PHPExcel_Worksheet_RowIterator
*/ */
public function getRowIterator($startRow = 1) { public function getRowIterator($startRow = 1)
{
return new PHPExcel_Worksheet_RowIterator($this,$startRow); return new PHPExcel_Worksheet_RowIterator($this,$startRow);
} }
@ -2497,7 +2519,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* *
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
*/ */
public function garbageCollect() { public function garbageCollect()
{
// Flush cache // Flush cache
$this->_cellCollection->getCacheData('A1'); $this->_cellCollection->getCacheData('A1');
// Build a reference table from images // Build a reference table from images
@ -2541,7 +2564,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* *
* @return string Hash code * @return string Hash code
*/ */
public function getHashCode() { public function getHashCode()
{
if ($this->_dirty) { if ($this->_dirty) {
$this->_hash = md5( $this->_title . $this->_hash = md5( $this->_title .
$this->_autoFilter . $this->_autoFilter .
@ -2563,7 +2587,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* @param bool $returnRange Return range? (see example) * @param bool $returnRange Return range? (see example)
* @return mixed * @return mixed
*/ */
public static function extractSheetTitle($pRange, $returnRange = false) { public static function extractSheetTitle($pRange, $returnRange = false)
{
// Sheet title included? // Sheet title included?
if (($sep = strpos($pRange, '!')) === false) { if (($sep = strpos($pRange, '!')) === false) {
return ''; return '';
@ -2694,7 +2719,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* @param string $range * @param string $range
* @return string Adjusted range value * @return string Adjusted range value
*/ */
public function shrinkRangeToFit($range) { public function shrinkRangeToFit($range)
{
$maxCol = $this->getHighestColumn(); $maxCol = $this->getHighestColumn();
$maxRow = $this->getHighestRow(); $maxRow = $this->getHighestRow();
$maxCol = PHPExcel_Cell::columnIndexFromString($maxCol); $maxCol = PHPExcel_Cell::columnIndexFromString($maxCol);
@ -2756,7 +2782,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* *
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
*/ */
public function copy() { public function copy()
{
$copied = clone $this; $copied = clone $this;
return $copied; return $copied;
@ -2765,7 +2792,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */
public function __clone() { public function __clone()
{
foreach ($this as $key => $val) { foreach ($this as $key => $val) {
if ($key == '_parent') { if ($key == '_parent') {
continue; continue;