mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-12-01 17:56:04 +03:00
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();
|
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
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user