diff --git a/src/PhpWord/Style/Paragraph.php b/src/PhpWord/Style/Paragraph.php index 81673586..ef966635 100644 --- a/src/PhpWord/Style/Paragraph.php +++ b/src/PhpWord/Style/Paragraph.php @@ -152,6 +152,13 @@ class Paragraph extends AbstractStyle */ private $tabs = array(); + /** + * Shading + * + * @var \PhpOffice\PhpWord\Style\Shading + */ + private $shading; + /** * Create new instance */ @@ -209,6 +216,7 @@ class Paragraph extends AbstractStyle 'level' => $this->getNumLevel(), ), 'tabs' => $this->getTabs(), + 'shading' => $this->getShading(), ); return $styles; @@ -694,4 +702,27 @@ class Paragraph extends AbstractStyle { 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; + } } diff --git a/src/PhpWord/Writer/Word2007/Style/Paragraph.php b/src/PhpWord/Writer/Word2007/Style/Paragraph.php index f3287700..71bb6e48 100644 --- a/src/PhpWord/Writer/Word2007/Style/Paragraph.php +++ b/src/PhpWord/Writer/Word2007/Style/Paragraph.php @@ -99,6 +99,13 @@ class Paragraph extends AbstractStyle $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']);