2012-05-06 18:25:40 +02: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.
|
2012-05-06 18:25:40 +02:00
|
|
|
*
|
2017-11-04 22:44:12 +01:00
|
|
|
* @see https://github.com/PHPOffice/PHPWord
|
2018-03-08 23:52:25 +01:00
|
|
|
* @copyright 2010-2018 PHPWord contributors
|
2014-05-04 21:03:28 +04:00
|
|
|
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
2012-05-06 18:25:40 +02:00
|
|
|
*/
|
|
|
|
|
|
2014-04-02 11:11:59 +07:00
|
|
|
namespace PhpOffice\PhpWord\Element;
|
2013-12-16 06:40:30 -05:00
|
|
|
|
2014-03-31 23:52:42 +07:00
|
|
|
use PhpOffice\PhpWord\Style\Cell as CellStyle;
|
2014-03-22 10:06:08 +04:00
|
|
|
|
2014-03-24 00:26:10 +07:00
|
|
|
/**
|
|
|
|
|
* Table cell element
|
|
|
|
|
*/
|
2014-04-26 13:29:43 +07:00
|
|
|
class Cell extends AbstractContainer
|
2014-03-22 10:06:08 +04:00
|
|
|
{
|
2014-05-11 22:54:51 +07:00
|
|
|
/**
|
|
|
|
|
* @var string Container type
|
|
|
|
|
*/
|
|
|
|
|
protected $container = 'Cell';
|
|
|
|
|
|
2013-12-16 06:40:30 -05:00
|
|
|
/**
|
2014-03-31 23:52:42 +07:00
|
|
|
* Cell width
|
2013-12-16 06:40:30 -05:00
|
|
|
*
|
|
|
|
|
* @var int
|
|
|
|
|
*/
|
2014-03-31 23:52:42 +07:00
|
|
|
private $width = null;
|
2013-12-16 06:40:30 -05:00
|
|
|
|
|
|
|
|
/**
|
2014-03-31 23:52:42 +07:00
|
|
|
* Cell style
|
2013-12-16 06:40:30 -05:00
|
|
|
*
|
2014-04-16 17:22:30 +04:00
|
|
|
* @var \PhpOffice\PhpWord\Style\Cell
|
2013-12-16 06:40:30 -05:00
|
|
|
*/
|
2014-05-11 22:54:51 +07:00
|
|
|
private $style;
|
2013-12-16 06:40:30 -05:00
|
|
|
|
|
|
|
|
/**
|
2014-03-31 23:52:42 +07:00
|
|
|
* Create new instance
|
2013-12-16 06:40:30 -05:00
|
|
|
*
|
|
|
|
|
* @param int $width
|
2014-04-16 17:22:30 +04:00
|
|
|
* @param array|\PhpOffice\PhpWord\Style\Cell $style
|
2013-12-16 06:40:30 -05:00
|
|
|
*/
|
2014-05-11 22:54:51 +07:00
|
|
|
public function __construct($width = null, $style = null)
|
2013-12-16 06:40:30 -05:00
|
|
|
{
|
2014-03-31 23:52:42 +07:00
|
|
|
$this->width = $width;
|
2014-06-08 16:44:46 +07:00
|
|
|
$this->style = $this->setNewStyle(new CellStyle(), $style, true);
|
2013-12-16 06:40:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2014-03-31 23:52:42 +07:00
|
|
|
* Get cell style
|
2013-12-16 06:40:30 -05:00
|
|
|
*
|
2014-04-16 17:22:30 +04:00
|
|
|
* @return \PhpOffice\PhpWord\Style\Cell
|
2013-12-16 06:40:30 -05:00
|
|
|
*/
|
|
|
|
|
public function getStyle()
|
|
|
|
|
{
|
2014-05-11 22:54:51 +07:00
|
|
|
return $this->style;
|
2013-12-16 06:40:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2014-03-31 23:52:42 +07:00
|
|
|
* Get cell width
|
2013-12-16 06:40:30 -05:00
|
|
|
*
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public function getWidth()
|
|
|
|
|
{
|
2014-03-31 23:52:42 +07:00
|
|
|
return $this->width;
|
2013-12-16 06:40:30 -05:00
|
|
|
}
|
2014-03-11 19:26:56 +07:00
|
|
|
}
|