@@ -2031,17 +2031,21 @@ def _size_element(self) -> ET.Element:
20312031 def _ensure_text_element (self ) -> ET .Element :
20322032 sublist = self .element .find (f"{ _HP } subList" )
20332033 if sublist is None :
2034- sublist = ET .SubElement (self .element , f"{ _HP } subList" , _default_sublist_attributes ())
2034+ sublist = _append_child (
2035+ self .element , f"{ _HP } subList" , _default_sublist_attributes ()
2036+ )
20352037 paragraph = sublist .find (f"{ _HP } p" )
20362038 if paragraph is None :
2037- paragraph = ET .SubElement (sublist , f"{ _HP } p" , _default_cell_paragraph_attributes ())
2039+ paragraph = _append_child (
2040+ sublist , f"{ _HP } p" , _default_cell_paragraph_attributes ()
2041+ )
20382042 _clear_paragraph_layout_cache (paragraph )
20392043 run = paragraph .find (f"{ _HP } run" )
20402044 if run is None :
2041- run = ET . SubElement (paragraph , f"{ _HP } run" , {"charPrIDRef" : "0" })
2045+ run = _append_child (paragraph , f"{ _HP } run" , {"charPrIDRef" : "0" })
20422046 text = run .find (f"{ _HP } t" )
20432047 if text is None :
2044- text = ET . SubElement (run , f"{ _HP } t" )
2048+ text = _append_child (run , f"{ _HP } t" )
20452049 return text
20462050
20472051 @property
@@ -4536,9 +4540,9 @@ def modifier(element: ET.Element) -> None:
45364540 element .remove (child )
45374541
45384542 if target [0 ]:
4539- ET . SubElement (element , f"{ _HH } bold" )
4543+ _append_child (element , f"{ _HH } bold" )
45404544 if target [1 ]:
4541- ET . SubElement (element , f"{ _HH } italic" )
4545+ _append_child (element , f"{ _HH } italic" )
45424546
45434547 underline_attrs = dict (base_underline_attrs )
45444548 if target [2 ]:
@@ -4550,14 +4554,14 @@ def modifier(element: ET.Element) -> None:
45504554 underline_attrs ["color" ] = base_underline_attrs ["color" ]
45514555 if "color" not in underline_attrs :
45524556 underline_attrs ["color" ] = "#000000"
4553- ET . SubElement (element , f"{ _HH } underline" , underline_attrs )
4557+ _append_child (element , f"{ _HH } underline" , underline_attrs )
45544558 else :
45554559 attrs = dict (base_underline_attrs )
45564560 attrs ["type" ] = "NONE"
45574561 attrs .setdefault ("shape" , base_underline_attrs .get ("shape" , "SOLID" ))
45584562 if "color" in base_underline_attrs :
45594563 attrs ["color" ] = base_underline_attrs ["color" ]
4560- ET . SubElement (element , f"{ _HH } underline" , attrs )
4564+ _append_child (element , f"{ _HH } underline" , attrs )
45614565
45624566 element = header .ensure_char_property (
45634567 predicate = predicate ,
0 commit comments