File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,13 @@ class Paragraph extends AbstractStyle
152
152
*/
153
153
private $ tabs = array ();
154
154
155
+ /**
156
+ * Shading
157
+ *
158
+ * @var \PhpOffice\PhpWord\Style\Shading
159
+ */
160
+ private $ shading ;
161
+
155
162
/**
156
163
* Create new instance
157
164
*/
@@ -209,6 +216,7 @@ public function getStyleValues()
209
216
'level ' => $ this ->getNumLevel (),
210
217
),
211
218
'tabs ' => $ this ->getTabs (),
219
+ 'shading ' => $ this ->getShading (),
212
220
);
213
221
214
222
return $ styles ;
@@ -674,4 +682,27 @@ public function getPageBreakBefore()
674
682
{
675
683
return $ this ->hasPageBreakBefore ();
676
684
}
685
+
686
+ /**
687
+ * Get shading
688
+ *
689
+ * @return \PhpOffice\PhpWord\Style\Shading
690
+ */
691
+ public function getShading ()
692
+ {
693
+ return $ this ->shading ;
694
+ }
695
+
696
+ /**
697
+ * Set shading
698
+ *
699
+ * @param mixed $value
700
+ * @return self
701
+ */
702
+ public function setShading ($ value = null )
703
+ {
704
+ $ this ->setObjectVal ($ value , 'Shading ' , $ this ->shading );
705
+
706
+ return $ this ;
707
+ }
677
708
}
Original file line number Diff line number Diff line change @@ -99,6 +99,13 @@ private function writeStyle()
99
99
$ this ->writeChildStyle ($ xmlWriter , 'Indentation ' , $ styles ['indentation ' ]);
100
100
$ this ->writeChildStyle ($ xmlWriter , 'Spacing ' , $ styles ['spacing ' ]);
101
101
102
+ // Background-Color
103
+ $ shading = $ style ->getShading ();
104
+ if (!is_null ($ shading )) {
105
+ $ styleWriter = new Shading ($ xmlWriter , $ shading );
106
+ $ styleWriter ->write ();
107
+ }
108
+
102
109
// Tabs
103
110
$ this ->writeTabs ($ xmlWriter , $ styles ['tabs ' ]);
104
111
You can’t perform that action at this time.
0 commit comments