diff --git a/composer.json b/composer.json index f5f751ec04..b129488e6d 100644 --- a/composer.json +++ b/composer.json @@ -58,7 +58,7 @@ "fix": "Fixes issues found by PHP-CS" }, "require": { - "php": "^5.3.3 || ^7.0", + "php": ">=7.2.5", "ext-xml": "*", "zendframework/zend-escaper": "^2.2", "phpoffice/common": "^0.2.9" @@ -90,7 +90,7 @@ }, "extra": { "branch-alias": { - "dev-develop": "0.18-dev" + "dev-develop": "0.19-dev" } } } diff --git a/src/PhpWord/Style/TextBox.php b/src/PhpWord/Style/TextBox.php index e9c0f0c064..47c02f6a5b 100644 --- a/src/PhpWord/Style/TextBox.php +++ b/src/PhpWord/Style/TextBox.php @@ -65,6 +65,13 @@ class TextBox extends Image * @var string */ private $borderColor; + + /** + * background color + * + * @var string + */ + private $bgColor; /** * Set margin top. @@ -227,4 +234,24 @@ public function getBorderColor() { return $this->borderColor; } + + /** + * Set background color + * + * @param string $value + */ + public function setBgColor($value = null) + { + $this->bgColor = $value; + } + + /** + * Get background color + * + * @return string + */ + public function getBgColor() + { + return $this->bgColor; + } } diff --git a/src/PhpWord/Writer/Word2007/Element/TextBox.php b/src/PhpWord/Writer/Word2007/Element/TextBox.php index 9dd4bc3e57..730f7fd525 100644 --- a/src/PhpWord/Writer/Word2007/Element/TextBox.php +++ b/src/PhpWord/Writer/Word2007/Element/TextBox.php @@ -49,6 +49,10 @@ public function write() $xmlWriter->startElement('w:pict'); $xmlWriter->startElement('v:shape'); $xmlWriter->writeAttribute('type', '#_x0000_t0202'); + + if ($style->getBgColor()) { + $xmlWriter->writeAttribute('fillcolor', $style->getBgColor()); + } $styleWriter->write(); $styleWriter->writeBorder();