Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/PhpWord/Style/Paragraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ class Paragraph extends AbstractStyle
*/
private $tabs = array();

/**
* Shading
*
* @var \PhpOffice\PhpWord\Style\Shading
*/
private $shading;

/**
* Create new instance
*/
Expand Down Expand Up @@ -209,6 +216,7 @@ public function getStyleValues()
'level' => $this->getNumLevel(),
),
'tabs' => $this->getTabs(),
'shading' => $this->getShading(),
);

return $styles;
Expand Down Expand Up @@ -694,4 +702,27 @@ public function getPageBreakBefore()
{
return $this->hasPageBreakBefore();
}

/**
* Get shading
*
* @return \PhpOffice\PhpWord\Style\Shading
*/
public function getShading()
{
return $this->shading;
}

/**
* Set shading
*
* @param mixed $value
* @return self
*/
public function setShading($value = null)
{
$this->setObjectVal($value, 'Shading', $this->shading);

return $this;
}
}
7 changes: 7 additions & 0 deletions src/PhpWord/Writer/Word2007/Style/Paragraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ private function writeStyle()
$this->writeChildStyle($xmlWriter, 'Indentation', $styles['indentation']);
$this->writeChildStyle($xmlWriter, 'Spacing', $styles['spacing']);

// Background-Color
$shading = $style->getShading();
if (!is_null($shading)) {
$styleWriter = new Shading($xmlWriter, $shading);
$styleWriter->write();
}

// Tabs
$this->writeTabs($xmlWriter, $styles['tabs']);

Expand Down