MCPcopy Index your code
hub / github.com/python-openxml/python-docx / insert_element_before

Method insert_element_before

src/docx/oxml/xmlchemy.py:664–670  ·  view source on GitHub ↗
(self, elm: ElementBase, *tagnames: str)

Source from the content-addressed store, hash-verified

662 return None
663
664 def insert_element_before(self, elm: ElementBase, *tagnames: str):
665 successor = self.first_child_found_in(*tagnames)
666 if successor is not None:
667 successor.addprevious(elm)
668 else:
669 self.append(elm)
670 return elm
671
672 def remove_all(self, *tagnames: str) -> None:
673 """Remove child elements with tagname (e.g. "a:p") in `tagnames`."""

Calls 2

first_child_found_inMethod · 0.95
appendMethod · 0.80