2014-03-22 10:06:08 +04:00
|
|
|
<?php
|
|
|
|
|
/**
|
2014-05-05 13:06:53 +04:00
|
|
|
* 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-22 10:06:08 +04:00
|
|
|
*
|
2014-03-27 23:55:06 +07:00
|
|
|
* @link https://github.com/PHPOffice/PHPWord
|
2016-07-31 12:35:06 +04:00
|
|
|
* @copyright 2010-2016 PHPWord contributors
|
2014-05-04 21:03:28 +04:00
|
|
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
2014-03-22 10:06:08 +04:00
|
|
|
*/
|
|
|
|
|
|
2014-04-02 11:11:59 +07:00
|
|
|
namespace PhpOffice\PhpWord\Element;
|
2014-03-22 10:06:08 +04:00
|
|
|
|
2014-04-03 08:44:41 +07:00
|
|
|
use PhpOffice\PhpWord\Style\Row as RowStyle;
|
|
|
|
|
|
2014-03-24 00:26:10 +07:00
|
|
|
/**
|
|
|
|
|
* Table row element
|
2014-04-17 16:19:23 +07:00
|
|
|
*
|
|
|
|
|
* @since 0.8.0
|
2014-03-24 00:26:10 +07:00
|
|
|
*/
|
2014-04-08 00:23:49 +07:00
|
|
|
class Row extends AbstractElement
|
2014-03-22 10:06:08 +04:00
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Row height
|
|
|
|
|
*
|
|
|
|
|
* @var int
|
|
|
|
|
*/
|
2014-04-03 08:44:41 +07:00
|
|
|
private $height = null;
|
2014-03-22 10:06:08 +04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Row style
|
|
|
|
|
*
|
2014-04-16 17:22:30 +04:00
|
|
|
* @var \PhpOffice\PhpWord\Style\Row
|
2014-03-22 10:06:08 +04:00
|
|
|
*/
|
2014-04-03 08:44:41 +07:00
|
|
|
private $style;
|
2014-03-22 10:06:08 +04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Row cells
|
|
|
|
|
*
|
2014-05-19 00:14:14 +07:00
|
|
|
* @var \PhpOffice\PhpWord\Element\Cell[]
|
2014-03-22 10:06:08 +04:00
|
|
|
*/
|
2014-04-03 08:44:41 +07:00
|
|
|
private $cells = array();
|
2014-03-22 10:06:08 +04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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-03-22 10:06:08 +04:00
|
|
|
{
|
2014-04-03 08:44:41 +07:00
|
|
|
$this->height = $height;
|
2014-06-08 16:44:46 +07:00
|
|
|
$this->style = $this->setNewStyle(new RowStyle(), $style, true);
|
2014-03-22 10:06:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Add a cell
|
|
|
|
|
*
|
|
|
|
|
* @param int $width
|
|
|
|
|
* @param mixed $style
|
2014-05-11 22:54:51 +07:00
|
|
|
* @return \PhpOffice\PhpWord\Element\Cell
|
2014-03-22 10:06:08 +04:00
|
|
|
*/
|
|
|
|
|
public function addCell($width = null, $style = null)
|
|
|
|
|
{
|
2014-05-11 22:54:51 +07:00
|
|
|
$cell = new Cell($width, $style);
|
2014-06-08 02:31:44 +07:00
|
|
|
$cell->setParentContainer($this);
|
2014-04-03 08:44:41 +07:00
|
|
|
$this->cells[] = $cell;
|
2014-05-11 22:54:51 +07:00
|
|
|
|
2014-03-22 10:06:08 +04:00
|
|
|
return $cell;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get all cells
|
|
|
|
|
*
|
2014-05-19 00:14:14 +07:00
|
|
|
* @return \PhpOffice\PhpWord\Element\Cell[]
|
2014-03-22 10:06:08 +04:00
|
|
|
*/
|
|
|
|
|
public function getCells()
|
|
|
|
|
{
|
2014-04-03 08:44:41 +07:00
|
|
|
return $this->cells;
|
2014-03-22 10:06:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get row style
|
|
|
|
|
*
|
2014-04-16 17:22:30 +04:00
|
|
|
* @return \PhpOffice\PhpWord\Style\Row
|
2014-03-22 10:06:08 +04:00
|
|
|
*/
|
|
|
|
|
public function getStyle()
|
|
|
|
|
{
|
2014-04-03 08:44:41 +07:00
|
|
|
return $this->style;
|
2014-03-22 10:06:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get row height
|
|
|
|
|
*
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public function getHeight()
|
|
|
|
|
{
|
2014-04-03 08:44:41 +07:00
|
|
|
return $this->height;
|
2014-03-22 10:06:08 +04:00
|
|
|
}
|
|
|
|
|
}
|