public setVerticalAlignmentForCellRange ( string $verticalAlignment, integer $startRow, integer $startColumn, integer $endRow = null, integer $endColumn = null ) | ||
$verticalAlignment | string | Vertical alignment of cell (default top). Represented by PHPRtfLite_Container::VERTICAL_ALIGN_* Possible values: PHPRtfLite_Container::VERTICAL_ALIGN_TOP => 'top' - top alignment; PHPRtfLite_Container::VERTICAL_ALIGN_CENTER => 'center' - center alignment; PHPRtfLite_Container::VERTICAL_ALIGN_BOTTOM => 'bottom' - bottom alignment. |
$startRow | integer | start row |
$startColumn | integer | start column |
$endRow | integer | end row, if null, then vertical alignment is set only to the row range. |
$endColumn | integer | end column, if null, then vertical alignment is set just to the column range. |
public function setVerticalAlignmentForCellRange($verticalAlignment, $startRow, $startColumn, $endRow = null, $endColumn = null)
{
list($startRow, $startColumn, $endRow, $endColumn) = PHPRtfLite_Table::getValidCellRange($startRow, $startColumn, $endRow, $endColumn);
if ($this->checkIfCellExists($startRow, $startColumn) && $this->checkIfCellExists($endRow, $endColumn)) {
$cells = $this->getCellsByCellRange($startRow, $startColumn, $endRow, $endColumn);
foreach ($cells as $cell) {
$cell->setVerticalAlignment($verticalAlignment);
}
}
}
/** * tests setVerticalAlignmentForCellRange */ public function testSetVerticalAlignmentForCell() { $this->_table->addRows(3); $this->_table->addColumnsList(array(5, 5, 5)); $this->_table->setVerticalAlignmentForCellRange(PHPRtfLite_Table_Cell::VERTICAL_ALIGN_CENTER, 2, 2); $cell = $this->_table->getCell(2, 2); $this->assertEquals(PHPRtfLite_Table_Cell::VERTICAL_ALIGN_CENTER, $cell->getVerticalAlignment()); }