Feature - New methods added for testing cell status within merge groups

This commit is contained in:
MarkBaker 2014-07-24 22:50:53 +01:00
parent dff9880582
commit 134bd0fda6

View File

@ -496,6 +496,45 @@ class PHPExcel_Cell
return $this->_parent->getParent(); return $this->_parent->getParent();
} }
/**
* Is this cell in a merge range
*
* @return boolean
*/
public function isInMergeRange() {
return (boolean) $this->getMergeRange();
}
/**
* Is this cell the master (top left cell) in a merge range (that holds the actual data value)
*
* @return boolean
*/
public function isMergeRangeValueCell() {
if ($mergeRange = $this->getMergeRange()) {
$mergeRange = PHPExcel_Cell::splitRange($mergeRange);
list($startCell) = $mergeRange[0];
if ($this->getCoordinate() === $startCell) {
return true;
}
}
return false;
}
/**
* If this cell is in a merge range, then return the range
*
* @return string
*/
public function getMergeRange() {
foreach($this->getWorksheet()->getMergeCells() as $mergeRange) {
if ($this->isInRange($mergeRange)) {
return $mergeRange;
}
}
return false;
}
/** /**
* Get cell style * Get cell style
* *