#294: Support for paragraph with borders

This commit is contained in:
Ivan Lanin 2014-06-28 22:59:00 +07:00
parent 689a7371cd
commit 33570f7cd4
4 changed files with 15 additions and 1 deletions

View File

@ -21,6 +21,7 @@ This release added form fields (textinput, checkbox, and dropdown), drawing shap
- Setting: Ability to define document protection (readOnly, comments, trackedChanges, forms) - @ivanlanin
- Setting: Ability to remove [Compatibility Mode] text in the MS Word title bar - @ivanlanin
- SDT: Ability to add structured document tag elements (comboBox, dropDownList, date) - @ivanlanin
- Paragraph: Support for paragraph with borders - @ivanlanin GH-294
### Bugfixes

View File

@ -47,7 +47,7 @@ use PhpOffice\PhpWord\Shared\String;
*
* @link http://www.schemacentral.com/sc/ooxml/t-w_CT_PPr.html
*/
class Paragraph extends AbstractStyle
class Paragraph extends Border
{
/**
* @const int One line height equals 240 twip

View File

@ -108,6 +108,18 @@ class Paragraph extends AbstractStyle
// Numbering
$this->writeNumbering($xmlWriter, $styles['numbering']);
// Border
if ($style->hasBorder()) {
$xmlWriter->startElement('w:pBdr');
$styleWriter = new MarginBorder($xmlWriter);
$styleWriter->setSizes($style->getBorderSize());
$styleWriter->setColors($style->getBorderColor());
$styleWriter->write();
$xmlWriter->endElement();
}
if (!$this->withoutPPR) {
$xmlWriter->endElement(); // w:pPr
}

View File

@ -139,6 +139,7 @@ class DocumentTest extends \PHPUnit_Framework_TestCase
'align' => 'center',
'tabs' => $tabs,
'shading' => array('fill' => 'FFFF99'),
'borderSize' => 4,
)); // Style #1
$phpWord->addFontStyle('fStyle', array('size' => '20', 'bold' => true, 'allCaps' => true,
'scale' => 200, 'spacing' => 240, 'kerning' => 10)); // Style #2