Skip to content
Closed
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
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -90,7 +90,7 @@
},
"extra": {
"branch-alias": {
"dev-develop": "0.18-dev"
"dev-develop": "0.19-dev"
}
}
}
27 changes: 27 additions & 0 deletions src/PhpWord/Style/TextBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ class TextBox extends Image
* @var string
*/
private $borderColor;

/**
* background color
*
* @var string
*/
private $bgColor;

/**
* Set margin top.
Expand Down Expand Up @@ -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;
}
}
4 changes: 4 additions & 0 deletions src/PhpWord/Writer/Word2007/Element/TextBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down