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

Method _remove_trailing_empty_p

src/docx/oxml/table.py:650–659  ·  view source on GitHub ↗

Remove last content element from this cell if it's an empty `w:p` element.

(self)

Source from the content-addressed store, hash-verified

648 parent_element.remove(self)
649
650 def _remove_trailing_empty_p(self):
651 """Remove last content element from this cell if it's an empty `w:p` element."""
652 block_items = list(self.iter_block_items())
653 last_content_elm = block_items[-1]
654 if not isinstance(last_content_elm, CT_P):
655 return
656 p = last_content_elm
657 if len(p.r_lst) > 0:
658 return
659 self.remove(p)
660
661 def _span_dimensions(self, other_tc: CT_Tc) -> tuple[int, int, int, int]:
662 """Return a (top, left, height, width) 4-tuple specifying the extents of the

Callers 1

_move_content_toMethod · 0.80

Calls 1

iter_block_itemsMethod · 0.95

Tested by

no test coverage detected