Paper Office
paper-pptxAPI referenceoxml.text

CT_TextParagraph

paper-pptx 0.2.0 API reference

a:p custom element class

Attributes

br

attributebr
= ZeroOrMore('a:br', successors=('a:endParaRPr',))

content_children

attributecontent_childrentuple[CT_RegularTextRun | CT_TextLineBreak | CT_TextField, ...]

Sequence containing text-container child elements of this a:p element.

These include a:r, a:br, and a:fld.

endParaRPr

attributeendParaRPrCT_TextCharacterProperties | None
= ZeroOrOne('a:endParaRPr', successors=())

get_or_add_endParaRPr

attributeget_or_add_endParaRPrCallable[[], CT_TextCharacterProperties]

get_or_add_pPr

attributeget_or_add_pPrCallable[[], CT_TextParagraphProperties]

pPr

attributepPrCT_TextParagraphProperties | None
= ZeroOrOne('a:pPr', successors=('a:r', 'a:br', 'a:fld', 'a:endParaRPr'))

r

attributer
= ZeroOrMore('a:r', successors=('a:endParaRPr',))

r_lst

attributer_lstlist[CT_RegularTextRun]

text

attributetextstr

str text contained in this paragraph.

xml

attributexmlstr

XML string for this element, suitable for testing purposes.

Pretty printed for readability and without an XML declaration at the top.

Functions

add_br

funcadd_br() -> CT_TextLineBreak

Return a newly appended a:br element.

Returns

pptx.oxml.text.CT_TextLineBreak

add_fld

funcadd_fld(id_str: str, field_type: str, cached_text: str) -> CT_TextField

Append an a:fld with id_str/field_type and cached a:t text (paper-pptx).

Content children (a:r/a:br/a:fld) precede a:endParaRPr per the schema; the new field is inserted accordingly.

paramid_strstr
paramfield_typestr
paramcached_textstr

Returns

pptx.oxml.text.CT_TextField

add_r

funcadd_r(text: str | None = None) -> CT_RegularTextRun

Return a newly appended a:r element.

paramtextstr | None
= None

Returns

pptx.oxml.text.CT_RegularTextRun

append_text

funcappend_text(text: str)

Append a:r and a:br elements to p based on text.

Any or (vertical-tab) characters in text delimit a:r (run) elements and themselves are translated to a:br (line-break) elements. The vertical-tab character appears in clipboard text from PowerPoint at "soft" line-breaks (new-line, but not new paragraph).

paramtextstr

first_child_found_in

funcfirst_child_found_in(*tagnames: str) -> _Element | None

First child with tag in tagnames, or None if not found.

paramtagnamesstr
= ()

Returns

lxml.etree._Element | None

insert_element_before

funcinsert_element_before(elm: ElementBase, *tagnames: str)
paramelmElementBase
paramtagnamesstr
= ()

remove_all

funcremove_all(*tagnames: str) -> None

Remove child elements with tagname (e.g. "a:p") in tagnames.

paramtagnamesstr
= ()

Returns

None

xpath

funcxpath(xpath_str: str) -> Any

Override of lxml _Element.xpath() method.

Provides standard Open XML namespace mapping (nsmap) in centralized location.

paramxpath_strstr

Returns

typing.Any

On this page