Remove fontStyle parameter from ListItemRun and various small fixes
This commit is contained in:
parent
e40b377fc8
commit
27fa3ba233
|
|
@ -9,7 +9,6 @@ tools:
|
|||
enabled: true
|
||||
config:
|
||||
standard: PSR2
|
||||
php_cpd: true
|
||||
php_mess_detector:
|
||||
enabled: true
|
||||
config:
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ This release marked the change of PHPWord license from LGPL 2.1 to LGPL 3; new r
|
|||
- RTF: UTF8 support for RTF: Internal UTF8 text is converted to Unicode before writing - @ivanlanin GH-158
|
||||
- Table: Ability to define table width (in percent and twip) and position - @ivanlanin GH-237
|
||||
- RTF: Ability to add links and page breaks in RTF - @ivanlanin GH-196
|
||||
- ListItemRun: Remove fontStyle parameter because ListItemRun is inherited from TextRun and TextRun doesn't have fontStyle - @ivanlanin
|
||||
|
||||
### Bugfixes
|
||||
|
||||
|
|
|
|||
|
|
@ -213,14 +213,13 @@ abstract class AbstractContainer extends AbstractElement
|
|||
* Add listitemrun element
|
||||
*
|
||||
* @param int $depth
|
||||
* @param mixed $fontStyle
|
||||
* @param mixed $listStyle
|
||||
* @param mixed $paragraphStyle
|
||||
* @return \PhpOffice\PhpWord\Element\ListItemRun
|
||||
*/
|
||||
public function addListItemRun($depth = 0, $fontStyle = null, $listStyle = null, $paragraphStyle = null)
|
||||
public function addListItemRun($depth = 0, $listStyle = null, $paragraphStyle = null)
|
||||
{
|
||||
return $this->addElement('ListItemRun', $depth, $fontStyle, $listStyle, $paragraphStyle);
|
||||
return $this->addElement('ListItemRun', $depth, $listStyle, $paragraphStyle);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -48,11 +48,10 @@ class ListItemRun extends TextRun
|
|||
* Create a new ListItem
|
||||
*
|
||||
* @param int $depth
|
||||
* @param mixed $fontStyle
|
||||
* @param array|string|null $listStyle
|
||||
* @param mixed $paragraphStyle
|
||||
*/
|
||||
public function __construct($depth = 0, $fontStyle = null, $listStyle = null, $paragraphStyle = null)
|
||||
public function __construct($depth = 0, $listStyle = null, $paragraphStyle = null)
|
||||
{
|
||||
$this->depth = $depth;
|
||||
|
||||
|
|
|
|||
|
|
@ -46,14 +46,6 @@ class Title extends AbstractElement
|
|||
*/
|
||||
private $style;
|
||||
|
||||
/**
|
||||
* Title anchor
|
||||
*
|
||||
* @var string
|
||||
* @deprecated 0.10.0
|
||||
*/
|
||||
private $anchor;
|
||||
|
||||
/**
|
||||
* Create a new Title Element
|
||||
*
|
||||
|
|
@ -101,52 +93,4 @@ class Title extends AbstractElement
|
|||
{
|
||||
return $this->style;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Anchor
|
||||
*
|
||||
* @param string $anchor
|
||||
* @deprecated 0.10.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function setAnchor($anchor)
|
||||
{
|
||||
$this->anchor = $anchor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Anchor
|
||||
*
|
||||
* @return string
|
||||
* @deprecated 0.10.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getAnchor()
|
||||
{
|
||||
return '_Toc' . (252634154 + $this->getRelationId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Bookmark ID
|
||||
*
|
||||
* @param int $value
|
||||
* @deprecated 0.11.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function setBookmarkId($value)
|
||||
{
|
||||
$this->setRelationId($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bookmark ID
|
||||
*
|
||||
* @return int
|
||||
* @deprecated 0.11.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getBookmarkId()
|
||||
{
|
||||
return $this->getRelationId();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,22 +78,6 @@ class Border extends AbstractStyle
|
|||
*/
|
||||
protected $borderBottomColor;
|
||||
|
||||
/**
|
||||
* Set border size
|
||||
*
|
||||
* @param int|float $value
|
||||
* @return self
|
||||
*/
|
||||
public function setBorderSize($value = null)
|
||||
{
|
||||
$this->setBorderTopSize($value);
|
||||
$this->setBorderLeftSize($value);
|
||||
$this->setBorderRightSize($value);
|
||||
$this->setBorderBottomSize($value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get border size
|
||||
*
|
||||
|
|
@ -110,17 +94,17 @@ class Border extends AbstractStyle
|
|||
}
|
||||
|
||||
/**
|
||||
* Set border color
|
||||
* Set border size
|
||||
*
|
||||
* @param string $value
|
||||
* @param int|float $value
|
||||
* @return self
|
||||
*/
|
||||
public function setBorderColor($value = null)
|
||||
public function setBorderSize($value = null)
|
||||
{
|
||||
$this->setBorderTopColor($value);
|
||||
$this->setBorderLeftColor($value);
|
||||
$this->setBorderRightColor($value);
|
||||
$this->setBorderBottomColor($value);
|
||||
$this->setBorderTopSize($value);
|
||||
$this->setBorderLeftSize($value);
|
||||
$this->setBorderRightSize($value);
|
||||
$this->setBorderBottomSize($value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
@ -141,14 +125,17 @@ class Border extends AbstractStyle
|
|||
}
|
||||
|
||||
/**
|
||||
* Set border top size
|
||||
* Set border color
|
||||
*
|
||||
* @param int|float $value
|
||||
* @param string $value
|
||||
* @return self
|
||||
*/
|
||||
public function setBorderTopSize($value = null)
|
||||
public function setBorderColor($value = null)
|
||||
{
|
||||
$this->borderTopSize = $value;
|
||||
$this->setBorderTopColor($value);
|
||||
$this->setBorderLeftColor($value);
|
||||
$this->setBorderRightColor($value);
|
||||
$this->setBorderBottomColor($value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
@ -163,6 +150,29 @@ class Border extends AbstractStyle
|
|||
return $this->borderTopSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set border top size
|
||||
*
|
||||
* @param int|float $value
|
||||
* @return self
|
||||
*/
|
||||
public function setBorderTopSize($value = null)
|
||||
{
|
||||
$this->borderTopSize = $this->setNumericVal($value, $this->borderTopSize);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get border top color
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBorderTopColor()
|
||||
{
|
||||
return $this->borderTopColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set border top color
|
||||
*
|
||||
|
|
@ -177,13 +187,13 @@ class Border extends AbstractStyle
|
|||
}
|
||||
|
||||
/**
|
||||
* Get border top color
|
||||
* Get border left size
|
||||
*
|
||||
* @return string
|
||||
* @return int|float
|
||||
*/
|
||||
public function getBorderTopColor()
|
||||
public function getBorderLeftSize()
|
||||
{
|
||||
return $this->borderTopColor;
|
||||
return $this->borderLeftSize;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -194,19 +204,19 @@ class Border extends AbstractStyle
|
|||
*/
|
||||
public function setBorderLeftSize($value = null)
|
||||
{
|
||||
$this->borderLeftSize = $value;
|
||||
$this->borderLeftSize = $this->setNumericVal($value, $this->borderLeftSize);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get border left size
|
||||
* Get border left color
|
||||
*
|
||||
* @return int|float
|
||||
* @return string
|
||||
*/
|
||||
public function getBorderLeftSize()
|
||||
public function getBorderLeftColor()
|
||||
{
|
||||
return $this->borderLeftSize;
|
||||
return $this->borderLeftColor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -223,13 +233,13 @@ class Border extends AbstractStyle
|
|||
}
|
||||
|
||||
/**
|
||||
* Get border left color
|
||||
* Get border right size
|
||||
*
|
||||
* @return string
|
||||
* @return int|float
|
||||
*/
|
||||
public function getBorderLeftColor()
|
||||
public function getBorderRightSize()
|
||||
{
|
||||
return $this->borderLeftColor;
|
||||
return $this->borderRightSize;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -240,19 +250,19 @@ class Border extends AbstractStyle
|
|||
*/
|
||||
public function setBorderRightSize($value = null)
|
||||
{
|
||||
$this->borderRightSize = $value;
|
||||
$this->borderRightSize = $this->setNumericVal($value, $this->borderRightSize);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get border right size
|
||||
* Get border right color
|
||||
*
|
||||
* @return int|float
|
||||
* @return string
|
||||
*/
|
||||
public function getBorderRightSize()
|
||||
public function getBorderRightColor()
|
||||
{
|
||||
return $this->borderRightSize;
|
||||
return $this->borderRightColor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -269,13 +279,13 @@ class Border extends AbstractStyle
|
|||
}
|
||||
|
||||
/**
|
||||
* Get border right color
|
||||
* Get border bottom size
|
||||
*
|
||||
* @return string
|
||||
* @return int|float
|
||||
*/
|
||||
public function getBorderRightColor()
|
||||
public function getBorderBottomSize()
|
||||
{
|
||||
return $this->borderRightColor;
|
||||
return $this->borderBottomSize;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -286,19 +296,19 @@ class Border extends AbstractStyle
|
|||
*/
|
||||
public function setBorderBottomSize($value = null)
|
||||
{
|
||||
$this->borderBottomSize = $value;
|
||||
$this->borderBottomSize = $this->setNumericVal($value, $this->borderBottomSize);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get border bottom size
|
||||
* Get border bottom color
|
||||
*
|
||||
* @return int|float
|
||||
* @return string
|
||||
*/
|
||||
public function getBorderBottomSize()
|
||||
public function getBorderBottomColor()
|
||||
{
|
||||
return $this->borderBottomSize;
|
||||
return $this->borderBottomColor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -315,30 +325,14 @@ class Border extends AbstractStyle
|
|||
}
|
||||
|
||||
/**
|
||||
* Get border bottom color
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBorderBottomColor()
|
||||
{
|
||||
return $this->borderBottomColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Has borders?
|
||||
* Check if any of the border is not null
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasBorders()
|
||||
public function hasBorder()
|
||||
{
|
||||
$hasBorders = false;
|
||||
$borders = $this->getBorderSize();
|
||||
for ($i = 0; $i < count($borders); $i++) {
|
||||
if (!is_null($borders[$i])) {
|
||||
$hasBorders = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $hasBorders;
|
||||
return $borders !== array_filter($borders, 'is_null');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,35 +34,35 @@ class Table extends Border
|
|||
*
|
||||
* @var \PhpOffice\PhpWord\Style\Table
|
||||
*/
|
||||
private $firstRow = null;
|
||||
private $firstRow;
|
||||
|
||||
/**
|
||||
* Cell margin top
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $cellMarginTop = null;
|
||||
private $cellMarginTop;
|
||||
|
||||
/**
|
||||
* Cell margin left
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $cellMarginLeft = null;
|
||||
private $cellMarginLeft;
|
||||
|
||||
/**
|
||||
* Cell margin right
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $cellMarginRight = null;
|
||||
private $cellMarginRight;
|
||||
|
||||
/**
|
||||
* Cell margin bottom
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $cellMarginBottom = null;
|
||||
private $cellMarginBottom;
|
||||
|
||||
/**
|
||||
* Border size inside horizontal
|
||||
|
|
@ -123,9 +123,12 @@ class Table extends Border
|
|||
public function __construct($tableStyle = null, $firstRowStyle = null)
|
||||
{
|
||||
$this->alignment = new Alignment();
|
||||
if (!is_null($firstRowStyle) && is_array($firstRowStyle)) {
|
||||
$this->firstRow = clone $this;
|
||||
if ($tableStyle !== null && is_array($tableStyle)) {
|
||||
$this->setStyleByArray($tableStyle);
|
||||
}
|
||||
|
||||
if ($firstRowStyle !== null && is_array($firstRowStyle)) {
|
||||
$this->firstRow = clone $this;
|
||||
unset($this->firstRow->firstRow);
|
||||
unset($this->firstRow->cellMarginBottom);
|
||||
unset($this->firstRow->cellMarginTop);
|
||||
|
|
@ -137,10 +140,6 @@ class Table extends Border
|
|||
unset($this->firstRow->borderInsideHSize);
|
||||
$this->firstRow->setStyleByArray($firstRowStyle);
|
||||
}
|
||||
|
||||
if (!is_null($tableStyle) && is_array($tableStyle)) {
|
||||
$this->setStyleByArray($tableStyle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -162,36 +161,20 @@ class Table extends Border
|
|||
{
|
||||
if (!is_null($this->shading)) {
|
||||
return $this->shading->getFill();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set background
|
||||
*
|
||||
* @param string $value
|
||||
* @return \PhpOffice\PhpWord\Style\Table
|
||||
* @return self
|
||||
*/
|
||||
public function setBgColor($value = null)
|
||||
{
|
||||
$this->setShading(array('fill' => $value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set TLRBHV Border Size
|
||||
*
|
||||
* @param int $value Border size in eighths of a point (1/8 point)
|
||||
* @return self
|
||||
*/
|
||||
public function setBorderSize($value = null)
|
||||
{
|
||||
$this->setBorderTopSize($value);
|
||||
$this->setBorderLeftSize($value);
|
||||
$this->setBorderRightSize($value);
|
||||
$this->setBorderBottomSize($value);
|
||||
$this->setBorderInsideHSize($value);
|
||||
$this->setBorderInsideVSize($value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
@ -214,19 +197,19 @@ class Table extends Border
|
|||
}
|
||||
|
||||
/**
|
||||
* Set TLRBHV Border Color
|
||||
* Set TLRBHV Border Size
|
||||
*
|
||||
* @param string $value
|
||||
* @param int $value Border size in eighths of a point (1/8 point)
|
||||
* @return self
|
||||
*/
|
||||
public function setBorderColor($value = null)
|
||||
public function setBorderSize($value = null)
|
||||
{
|
||||
$this->setBorderTopColor($value);
|
||||
$this->setBorderLeftColor($value);
|
||||
$this->setBorderRightColor($value);
|
||||
$this->setBorderBottomColor($value);
|
||||
$this->setBorderInsideHColor($value);
|
||||
$this->setBorderInsideVColor($value);
|
||||
$this->setBorderTopSize($value);
|
||||
$this->setBorderLeftSize($value);
|
||||
$this->setBorderRightSize($value);
|
||||
$this->setBorderBottomSize($value);
|
||||
$this->setBorderInsideHSize($value);
|
||||
$this->setBorderInsideVSize($value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
@ -249,13 +232,21 @@ class Table extends Border
|
|||
}
|
||||
|
||||
/**
|
||||
* Set border size inside horizontal
|
||||
* Set TLRBHV Border Color
|
||||
*
|
||||
* @param int $value
|
||||
* @param string $value
|
||||
* @return self
|
||||
*/
|
||||
public function setBorderInsideHSize($value = null)
|
||||
public function setBorderColor($value = null)
|
||||
{
|
||||
$this->borderInsideHSize = $value;
|
||||
$this->setBorderTopColor($value);
|
||||
$this->setBorderLeftColor($value);
|
||||
$this->setBorderRightColor($value);
|
||||
$this->setBorderBottomColor($value);
|
||||
$this->setBorderInsideHColor($value);
|
||||
$this->setBorderInsideVColor($value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -265,37 +256,20 @@ class Table extends Border
|
|||
*/
|
||||
public function getBorderInsideHSize()
|
||||
{
|
||||
return (isset($this->borderInsideHSize)) ? $this->borderInsideHSize : null;
|
||||
return isset($this->borderInsideHSize) ? $this->borderInsideHSize : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set border size inside vertical
|
||||
* Set border size inside horizontal
|
||||
*
|
||||
* @param int $value
|
||||
* @return self
|
||||
*/
|
||||
public function setBorderInsideVSize($value = null)
|
||||
public function setBorderInsideHSize($value = null)
|
||||
{
|
||||
$this->borderInsideVSize = $value;
|
||||
}
|
||||
$this->borderInsideHSize = $this->setNumericVal($value, $this->borderInsideHSize);
|
||||
|
||||
/**
|
||||
* Get border size inside vertical
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getBorderInsideVSize()
|
||||
{
|
||||
return (isset($this->borderInsideVSize)) ? $this->borderInsideVSize : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set border color inside horizontal
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
public function setBorderInsideHColor($value = null)
|
||||
{
|
||||
$this->borderInsideHColor = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -305,17 +279,43 @@ class Table extends Border
|
|||
*/
|
||||
public function getBorderInsideHColor()
|
||||
{
|
||||
return (isset($this->borderInsideHColor)) ? $this->borderInsideHColor : null;
|
||||
return isset($this->borderInsideHColor) ? $this->borderInsideHColor : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set border color inside vertical
|
||||
* Set border color inside horizontal
|
||||
*
|
||||
* @param string $value
|
||||
* @return self
|
||||
*/
|
||||
public function setBorderInsideVColor($value = null)
|
||||
public function setBorderInsideHColor($value = null)
|
||||
{
|
||||
$this->borderInsideVColor = $value;
|
||||
$this->borderInsideHColor = $value ;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get border size inside vertical
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getBorderInsideVSize()
|
||||
{
|
||||
return isset($this->borderInsideVSize) ? $this->borderInsideVSize : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set border size inside vertical
|
||||
*
|
||||
* @param int $value
|
||||
* @return self
|
||||
*/
|
||||
public function setBorderInsideVSize($value = null)
|
||||
{
|
||||
$this->borderInsideVSize = $this->setNumericVal($value, $this->borderInsideVSize);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -325,17 +325,20 @@ class Table extends Border
|
|||
*/
|
||||
public function getBorderInsideVColor()
|
||||
{
|
||||
return (isset($this->borderInsideVColor)) ? $this->borderInsideVColor : null;
|
||||
return isset($this->borderInsideVColor) ? $this->borderInsideVColor : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set cell margin top
|
||||
* Set border color inside vertical
|
||||
*
|
||||
* @param int $value
|
||||
* @param string $value
|
||||
* @return self
|
||||
*/
|
||||
public function setCellMarginTop($value = null)
|
||||
public function setBorderInsideVColor($value = null)
|
||||
{
|
||||
$this->cellMarginTop = $value;
|
||||
$this->borderInsideVColor = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -349,13 +352,16 @@ class Table extends Border
|
|||
}
|
||||
|
||||
/**
|
||||
* Set cell margin left
|
||||
* Set cell margin top
|
||||
*
|
||||
* @param int $value
|
||||
* @return self
|
||||
*/
|
||||
public function setCellMarginLeft($value = null)
|
||||
public function setCellMarginTop($value = null)
|
||||
{
|
||||
$this->cellMarginLeft = $value;
|
||||
$this->cellMarginTop = $this->setNumericVal($value, $this->cellMarginTop);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -369,13 +375,16 @@ class Table extends Border
|
|||
}
|
||||
|
||||
/**
|
||||
* Set cell margin right
|
||||
* Set cell margin left
|
||||
*
|
||||
* @param int $value
|
||||
* @return self
|
||||
*/
|
||||
public function setCellMarginRight($value = null)
|
||||
public function setCellMarginLeft($value = null)
|
||||
{
|
||||
$this->cellMarginRight = $value;
|
||||
$this->cellMarginLeft = $this->setNumericVal($value, $this->cellMarginLeft);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -389,13 +398,16 @@ class Table extends Border
|
|||
}
|
||||
|
||||
/**
|
||||
* Set cell margin bottom
|
||||
* Set cell margin right
|
||||
*
|
||||
* @param int $value
|
||||
* @return self
|
||||
*/
|
||||
public function setCellMarginBottom($value = null)
|
||||
public function setCellMarginRight($value = null)
|
||||
{
|
||||
$this->cellMarginBottom = $value;
|
||||
$this->cellMarginRight = $this->setNumericVal($value, $this->cellMarginRight);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -409,16 +421,16 @@ class Table extends Border
|
|||
}
|
||||
|
||||
/**
|
||||
* Set TLRB cell margin
|
||||
* Set cell margin bottom
|
||||
*
|
||||
* @param int $value Margin in twips
|
||||
* @param int $value
|
||||
* @return self
|
||||
*/
|
||||
public function setCellMargin($value = null)
|
||||
public function setCellMarginBottom($value = null)
|
||||
{
|
||||
$this->setCellMarginTop($value);
|
||||
$this->setCellMarginLeft($value);
|
||||
$this->setCellMarginRight($value);
|
||||
$this->setCellMarginBottom($value);
|
||||
$this->cellMarginBottom = $this->setNumericVal($value, $this->cellMarginBottom);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -428,25 +440,40 @@ class Table extends Border
|
|||
*/
|
||||
public function getCellMargin()
|
||||
{
|
||||
return array($this->cellMarginTop, $this->cellMarginLeft, $this->cellMarginRight, $this->cellMarginBottom);
|
||||
return array(
|
||||
$this->cellMarginTop,
|
||||
$this->cellMarginLeft,
|
||||
$this->cellMarginRight,
|
||||
$this->cellMarginBottom
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Has margins?
|
||||
* Set TLRB cell margin
|
||||
*
|
||||
* @param int $value Margin in twips
|
||||
* @return self
|
||||
*/
|
||||
public function setCellMargin($value = null)
|
||||
{
|
||||
$this->setCellMarginTop($value);
|
||||
$this->setCellMarginLeft($value);
|
||||
$this->setCellMarginRight($value);
|
||||
$this->setCellMarginBottom($value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if any of the margin is not null
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasMargins()
|
||||
public function hasMargin()
|
||||
{
|
||||
$hasMargins = false;
|
||||
$margins = $this->getCellMargin();
|
||||
for ($i = 0; $i < count($margins); $i++) {
|
||||
if (!is_null($margins[$i])) {
|
||||
$hasMargins = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $hasMargins;
|
||||
return $margins !== array_filter($margins, 'is_null');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ class Text extends AbstractElement
|
|||
/** @var \PhpOffice\PhpWord\Element\Text $element Type hint */
|
||||
$element = $this->element;
|
||||
$style = '';
|
||||
if (method_exists($element, 'getParagraphStyle')) {
|
||||
if (!method_exists($element, 'getParagraphStyle')) {
|
||||
return $style;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
namespace PhpOffice\PhpWord\Writer\Word2007\Element;
|
||||
|
||||
use PhpOffice\PhpWord\Element\AbstractElement as Element;
|
||||
use PhpOffice\PhpWord\Exception\Exception;
|
||||
use PhpOffice\PhpWord\Shared\String;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
|
||||
|
|
@ -83,7 +82,6 @@ abstract class AbstractElement
|
|||
* Get element
|
||||
*
|
||||
* @return \PhpOffice\PhpWord\Element\AbstractElement
|
||||
* @throws \PhpOffice\PhpWord\Exception\Exception
|
||||
*/
|
||||
protected function getElement()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Part;
|
||||
|
||||
use PhpOffice\PhpWord\Exception\Exception;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
|
||||
/**
|
||||
|
|
@ -77,7 +76,6 @@ class ContentTypes extends AbstractPart
|
|||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter XML Writer
|
||||
* @param array $parts
|
||||
* @param boolean $isDefault
|
||||
* @throws \PhpOffice\PhpWord\Exception\Exception
|
||||
*/
|
||||
private function writeContentType(XMLWriter $xmlWriter, $parts, $isDefault)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class Cell extends AbstractStyle
|
|||
$xmlWriter->writeElementIf(!is_null($vAlign), 'w:vAlign', 'w:val', $vAlign);
|
||||
|
||||
// Border
|
||||
if ($style->hasBorders()) {
|
||||
if ($style->hasBorder()) {
|
||||
$xmlWriter->startElement('w:tcBorders');
|
||||
|
||||
$styleWriter = new MarginBorder($xmlWriter);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class Section extends AbstractStyle
|
|||
$xmlWriter->endElement();
|
||||
|
||||
// Borders
|
||||
if ($style->hasBorders()) {
|
||||
if ($style->hasBorder()) {
|
||||
$xmlWriter->startElement('w:pgBorders');
|
||||
$xmlWriter->writeAttribute('w:offsetFrom', 'page');
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class Table extends AbstractStyle
|
|||
*/
|
||||
private function writeMargin(XMLWriter $xmlWriter, TableStyle $style)
|
||||
{
|
||||
if ($style->hasMargins()) {
|
||||
if ($style->hasMargin()) {
|
||||
$xmlWriter->startElement('w:tblCellMar');
|
||||
|
||||
$styleWriter = new MarginBorder($xmlWriter);
|
||||
|
|
@ -118,7 +118,7 @@ class Table extends AbstractStyle
|
|||
*/
|
||||
private function writeBorder(XMLWriter $xmlWriter, TableStyle $style)
|
||||
{
|
||||
if ($style->hasBorders()) {
|
||||
if ($style->hasBorder()) {
|
||||
$xmlWriter->startElement('w:tblBorders');
|
||||
|
||||
$styleWriter = new MarginBorder($xmlWriter);
|
||||
|
|
|
|||
Loading…
Reference in New Issue