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 ;
@@ -694,4 +702,27 @@ public function getPageBreakBefore()
694
702
{
695
703
return $ this ->hasPageBreakBefore ();
696
704
}
705
+
706
+ /**
707
+ * Get shading
708
+ *
709
+ * @return \PhpOffice\PhpWord\Style\Shading
710
+ */
711
+ public function getShading ()
712
+ {
713
+ return $ this ->shading ;
714
+ }
715
+
716
+ /**
717
+ * Set shading
718
+ *
719
+ * @param mixed $value
720
+ * @return self
721
+ */
722
+ public function setShading ($ value = null )
723
+ {
724
+ $ this ->setObjectVal ($ value , 'Shading ' , $ this ->shading );
725
+
726
+ return $ this ;
727
+ }
697
728
}
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