CT_TextBody
paper-pptx 0.2.0 API reference
p:txBody custom element class.
Also used for c:txPr in charts and perhaps other elements.
Attributes
add_p
attributeadd_pCallable[[], CT_TextParagraph]bodyPr
attributebodyPrCT_TextBodyProperties= OneAndOnlyOne('a:bodyPr')defRPr
attributedefRPrCT_TextCharacterPropertiesa:defRPr element of required first p child, added with its ancestors if not present.
Used when element is a c:txPr in a chart and the p element is used only to specify
formatting, not content.
is_empty
attributeis_emptyboolTrue if only a single empty a:p element is present.
lstStyle
attributelstStyleCT_TextListStyle | None= ZeroOrOne('a:lstStyle', successors=('a:p',))p
attributepCT_TextParagraph= OneOrMore('a:p')p_lst
attributep_lstlist[CT_TextParagraph]xml
attributexmlstrXML string for this element, suitable for testing purposes.
Pretty printed for readability and without an XML declaration at the top.
Functions
clear_content
funcclear_content()Remove all a:p children, but leave any others.
cf. lxml _Element.clear() method which removes all children.
first_child_found_in
funcfirst_child_found_in(*tagnames: str) -> _Element | NoneFirst child with tag in tagnames, or None if not found.
paramtagnamesstr= ()Returns
lxml.etree._Element | Noneinsert_element_before
funcinsert_element_before(elm: ElementBase, *tagnames: str)paramelmElementBaseparamtagnamesstr= ()new
funcnew()Return a new p:txBody element tree.
new_a_txBody
funcnew_a_txBody() -> CT_TextBodyReturn a new a:txBody element tree.
Suitable for use in a table cell and possibly other situations.
Returns
pptx.oxml.text.CT_TextBodynew_p_txBody
funcnew_p_txBody()Return a new p:txBody element tree, suitable for use in an p:sp element.
new_txPr
funcnew_txPr()Return a c:txPr element tree.
Suitable for use in a chart object like data labels or tick labels.
remove_all
funcremove_all(*tagnames: str) -> NoneRemove child elements with tagname (e.g. "a:p") in tagnames.
paramtagnamesstr= ()Returns
Noneunclear_content
funcunclear_content()Ensure p:txBody has at least one a:p child.
Intuitively, reverse a ".clear_content()" operation to minimum conformance with spec (single empty paragraph).
xpath
funcxpath(xpath_str: str) -> AnyOverride of lxml _Element.xpath() method.
Provides standard Open XML namespace mapping (nsmap) in centralized location.
paramxpath_strstrReturns
typing.Any