2012-05-06 18:25:40 +02:00
|
|
|
<?php
|
|
|
|
|
/**
|
2014-03-26 16:33:20 +07:00
|
|
|
* PHPWord
|
2012-05-06 18:25:40 +02:00
|
|
|
*
|
2014-03-27 23:55:06 +07:00
|
|
|
* @link https://github.com/PHPOffice/PHPWord
|
|
|
|
|
* @copyright 2014 PHPWord
|
|
|
|
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
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\Container\Container;
|
|
|
|
|
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-03-31 23:52:42 +07:00
|
|
|
class Cell extends Container
|
2014-03-22 10:06:08 +04:00
|
|
|
{
|
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-03-31 23:52:42 +07:00
|
|
|
* @var CellStyle
|
2013-12-16 06:40:30 -05:00
|
|
|
*/
|
2014-03-31 23:52:42 +07:00
|
|
|
private $cellStyle;
|
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
|
|
|
*
|
2014-04-02 09:01:44 +07:00
|
|
|
* @param string $docPart section|header|footer
|
2014-04-01 15:01:30 +07:00
|
|
|
* @param int $docPartId
|
2013-12-16 06:40:30 -05:00
|
|
|
* @param int $width
|
2014-03-31 23:52:42 +07:00
|
|
|
* @param array|CellStyle $style
|
2013-12-16 06:40:30 -05:00
|
|
|
*/
|
2014-04-02 09:01:44 +07:00
|
|
|
public function __construct($docPart, $docPartId, $width = null, $style = null)
|
2013-12-16 06:40:30 -05:00
|
|
|
{
|
2014-04-02 09:01:44 +07:00
|
|
|
$this->container = 'cell';
|
|
|
|
|
$this->docPart = $docPart;
|
2014-04-01 15:01:30 +07:00
|
|
|
$this->docPartId = $docPartId;
|
2014-03-31 23:52:42 +07:00
|
|
|
$this->width = $width;
|
2014-04-03 08:44:41 +07:00
|
|
|
$this->cellStyle = $this->setStyle(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-03-31 23:52:42 +07:00
|
|
|
* @return CellStyle
|
2013-12-16 06:40:30 -05:00
|
|
|
*/
|
|
|
|
|
public function getStyle()
|
|
|
|
|
{
|
2014-03-31 23:52:42 +07:00
|
|
|
return $this->cellStyle;
|
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
|
|
|
}
|