108 lines
2.2 KiB
PHP
Raw Normal View History

<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
*
* PHPWord is free software distributed under the terms of the GNU Lesser
* General Public License version 3 as published by the Free Software Foundation.
*
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code. For the full list of
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
2014-03-27 23:55:06 +07:00
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2014 PHPWord contributors
2014-05-04 21:03:28 +04:00
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
2014-04-03 08:44:41 +07:00
use PhpOffice\PhpWord\Style\Row as RowStyle;
/**
* Table row element
*
* @since 0.8.0
*/
class Row extends AbstractElement
{
/**
* Row height
*
* @var int
*/
2014-04-03 08:44:41 +07:00
private $height = null;
/**
* Row style
*
* @var \PhpOffice\PhpWord\Style\Row
*/
2014-04-03 08:44:41 +07:00
private $style;
/**
* Row cells
*
2014-05-19 00:14:14 +07:00
* @var \PhpOffice\PhpWord\Element\Cell[]
*/
2014-04-03 08:44:41 +07:00
private $cells = array();
/**
* Create a new table row
*
* @param int $height
* @param mixed $style
*/
2014-05-11 22:54:51 +07:00
public function __construct($height = null, $style = null)
{
2014-04-03 08:44:41 +07:00
$this->height = $height;
$this->style = $this->setStyle(new RowStyle(), $style, true);
}
/**
* Add a cell
*
* @param int $width
* @param mixed $style
2014-05-11 22:54:51 +07:00
* @return \PhpOffice\PhpWord\Element\Cell
*/
public function addCell($width = null, $style = null)
{
2014-05-11 22:54:51 +07:00
$cell = new Cell($width, $style);
$cell->setParentContainer($this);
2014-04-03 08:44:41 +07:00
$this->cells[] = $cell;
2014-05-11 22:54:51 +07:00
return $cell;
}
/**
* Get all cells
*
2014-05-19 00:14:14 +07:00
* @return \PhpOffice\PhpWord\Element\Cell[]
*/
public function getCells()
{
2014-04-03 08:44:41 +07:00
return $this->cells;
}
/**
* Get row style
*
* @return \PhpOffice\PhpWord\Style\Row
*/
public function getStyle()
{
2014-04-03 08:44:41 +07:00
return $this->style;
}
/**
* Get row height
*
* @return int
*/
public function getHeight()
{
2014-04-03 08:44:41 +07:00
return $this->height;
}
}