public function mergeCellRange($startRow, $startColumn, $endRow, $endColumn)
{
list($startRow, $startColumn, $endRow, $endColumn) = PHPRtfLite_Table::getValidCellRange($startRow, $startColumn, $endRow, $endColumn);
if ($startRow == $endRow && $startColumn == $endColumn) {
return;
}
if (!$this->checkIfCellExists($endRow, $endColumn)) {
return;
}
for ($j = $startRow; $j <= $endRow; $j++) {
$start = $startColumn;
$cell = $this->getCell($j, $start);
while ($cell->isHorizontalMerged()) {
$start--;
$cell = $this->getCell($j, $start);
}
$end = $endColumn;
$cell = $this->getCell($j, $end);
while ($cell->isHorizontalMerged()) {
$end++;
$cell = $this->getCell($j, $end + 1);
}
$width = 0;
for ($i = $start; $i <= $end; $i++) {
$cell = $this->getCell($j, $i);
if ($j == $startRow) {
$cell->setVerticalMergeStart();
} else {
$cell->setVerticalMerged();
}
$width += $cell->getWidth();
if ($i != $start) {
$cell->setHorizontalMerged();
}
}
$this->getCell($j, $start)->setWidth($width);
}
}