Feature - New methods added for testing cell status within merge groups
This commit is contained in:
parent
dff9880582
commit
134bd0fda6
|
@ -496,6 +496,45 @@ class PHPExcel_Cell
|
|||
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
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue