PHPRtfLite_Table::rotateCellRange PHP Méthode

rotateCellRange() public méthode

rotates cells of a given cell range
public rotateCellRange ( string $rotateTo, integer $startRow, integer $startColumn, integer $endRow = null, integer $endColumn = null )
$rotateTo string direction of rotation
Possible values (represented by PHPRtfLite_Table_Cell::ROTATE_*):
PHPRtfLite_Table_Cell::ROTATE_RIGHT => 'right'
PHPRtfLite_Table_Cell::ROTATE_LEFT => 'left'
$startRow integer start row
$startColumn integer start column
$endRow integer end row, if null, then rotation is set only to the row range.
$endColumn integer end column, if null, then rotation is set just to the column range.
    public function rotateCellRange($rotateTo, $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->rotateTo($rotateTo);
            }
        }
    }

Usage Example

Exemple #1
0
 /**
  * tests rotateCellRange
  */
 public function testRotateCellRange()
 {
     $rotateTo = PHPRtfLite_Table_Cell::ROTATE_RIGHT;
     $this->_table->addRows(3);
     $this->_table->addColumnsList(array(5, 5, 5));
     $this->_table->rotateCellRange($rotateTo, 2, 2, 3, 3);
     for ($rowIndex = 2; $rowIndex < 4; $rowIndex++) {
         for ($columnIndex = 2; $columnIndex < 4; $columnIndex++) {
             $cell = $this->_table->getCell($rowIndex, $columnIndex);
             $this->assertEquals($rotateTo, $cell->getRotateTo());
         }
     }
 }