Skip to content

Commit 479713d

Browse files
committed
Update changelog and unit test for #264
1 parent 00c6b76 commit 479713d

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This is the changelog between releases of PHPWord. Releases are listed in revers
88

99
- Element: Ability to add drawing shapes (arc, curve, line, polyline, rect, oval) using new `Shape` element - @ivanlanin GH-123
1010
- Font: New `scale`, `spacing`, and `kerning` property of font style - @ivanlanin
11+
- Paragraph: Added shading to the paragraph style for full width shading - @lrobert GH-264
1112

1213
### Bugfixes
1314

src/PhpWord/Writer/Word2007/Style/Paragraph.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,10 @@ private function writeStyle()
9595
$xmlWriter->writeElementIf($styles['pagination']['keepLines'] === true, 'w:keepLines', 'w:val', '1');
9696
$xmlWriter->writeElementIf($styles['pagination']['pageBreak'] === true, 'w:pageBreakBefore', 'w:val', '1');
9797

98-
// Indentation & spacing
98+
// Child style: indentation, spacing, and shading
9999
$this->writeChildStyle($xmlWriter, 'Indentation', $styles['indentation']);
100100
$this->writeChildStyle($xmlWriter, 'Spacing', $styles['spacing']);
101-
102-
// Background-Color
103-
$shading = $style->getShading();
104-
if (!is_null($shading)) {
105-
$styleWriter = new Shading($xmlWriter, $shading);
106-
$styleWriter->write();
107-
}
101+
$this->writeChildStyle($xmlWriter, 'Shading', $styles['shading']);
108102

109103
// Tabs
110104
$this->writeTabs($xmlWriter, $styles['tabs']);

tests/PhpWord/Tests/Writer/Word2007/Part/DocumentTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ public function testElementStyles()
135135

136136
$tabs = array(new \PhpOffice\PhpWord\Style\Tab('right', 9090));
137137
$phpWord = new PhpWord();
138-
$phpWord->addParagraphStyle('pStyle', array('align' => 'center', 'tabs' => $tabs)); // Style #1
138+
$phpWord->addParagraphStyle('pStyle', array(
139+
'align' => 'center',
140+
'tabs' => $tabs,
141+
'shading' => array('fill' => 'FFFF99'),
142+
)); // Style #1
139143
$phpWord->addFontStyle('fStyle', array('size' => '20', 'bold' => true, 'allCaps' => true,
140144
'scale' => 200, 'spacing' => 240, 'kerning' => 10)); // Style #2
141145
$phpWord->addTitleStyle(1, array('color' => '333333', 'doubleStrikethrough' => true)); // Style #3

0 commit comments

Comments
 (0)