From fd2d53ba6b947fa9bf97ee4b2edefa45e0035695 Mon Sep 17 00:00:00 2001 From: eweso Date: Thu, 16 Apr 2020 23:01:22 +0200 Subject: [PATCH 1/4] Add background color to the TextBox style --- src/PhpWord/Style/TextBox.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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; + } } From 8988afb69c2dbaf9373aea9b0dc6b5681aa6e44a Mon Sep 17 00:00:00 2001 From: eweso Date: Thu, 16 Apr 2020 23:02:52 +0200 Subject: [PATCH 2/4] Write background color into TextBox --- src/PhpWord/Writer/Word2007/Element/TextBox.php | 4 ++++ 1 file changed, 4 insertions(+) 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(); From 6ef70027fe180fb61e07e36dcac769b8a37b1559 Mon Sep 17 00:00:00 2001 From: eweso Date: Fri, 14 May 2021 20:45:43 +0200 Subject: [PATCH 3/4] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f5f751ec04..ade0074140 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" From 3c216888b780ff493ef7d8f4c208df47048563c9 Mon Sep 17 00:00:00 2001 From: eweso Date: Fri, 14 May 2021 20:46:33 +0200 Subject: [PATCH 4/4] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ade0074140..b129488e6d 100644 --- a/composer.json +++ b/composer.json @@ -90,7 +90,7 @@ }, "extra": { "branch-alias": { - "dev-develop": "0.18-dev" + "dev-develop": "0.19-dev" } } }