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
152152 */
153153 private $ tabs = array ();
154154
155+ /**
156+ * Shading
157+ *
158+ * @var \PhpOffice\PhpWord\Style\Shading
159+ */
160+ private $ shading ;
161+
155162 /**
156163 * Create new instance
157164 */
@@ -209,6 +216,7 @@ public function getStyleValues()
209216 'level ' => $ this ->getNumLevel (),
210217 ),
211218 'tabs ' => $ this ->getTabs (),
219+ 'shading ' => $ this ->getShading (),
212220 );
213221
214222 return $ styles ;
@@ -694,4 +702,27 @@ public function getPageBreakBefore()
694702 {
695703 return $ this ->hasPageBreakBefore ();
696704 }
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+ }
697728}
Original file line number Diff line number Diff line change @@ -99,6 +99,13 @@ private function writeStyle()
9999 $ this ->writeChildStyle ($ xmlWriter , 'Indentation ' , $ styles ['indentation ' ]);
100100 $ this ->writeChildStyle ($ xmlWriter , 'Spacing ' , $ styles ['spacing ' ]);
101101
102+ // Background-Color
103+ $ shading = $ style ->getShading ();
104+ if (!is_null ($ shading )) {
105+ $ styleWriter = new Shading ($ xmlWriter , $ shading );
106+ $ styleWriter ->write ();
107+ }
108+
102109 // Tabs
103110 $ this ->writeTabs ($ xmlWriter , $ styles ['tabs ' ]);
104111
You can’t perform that action at this time.
0 commit comments