CT_R
paper-docx 0.2.0 API reference
<w:r> element, containing the properties and text for a run.
Attributes
add_br
attributeadd_brCallable[[], CT_Br]add_tab
attributeadd_tabCallable[[], CT_TabStop]br
attributebr= ZeroOrMore('w:br')cr
attributecr= ZeroOrMore('w:cr')drawing
attributedrawing= ZeroOrMore('w:drawing')get_or_add_rPr
attributeget_or_add_rPrCallable[[], CT_RPr]inner_content_items
attributeinner_content_itemsList[str | CT_Drawing | CT_LastRenderedPageBreak]Text of run, possibly punctuated by w:lastRenderedPageBreak elements.
lastRenderedPageBreaks
attributelastRenderedPageBreaksList[CT_LastRenderedPageBreak]All w:lastRenderedPageBreaks descendants of this run.
rPr
attributerPrCT_RPr | None= ZeroOrOne('w:rPr')style
attributestylestr | NoneString contained in w:val attribute of w:rStyle grandchild.
None if that element is not present.
t
attributet= ZeroOrMore('w:t')tab
attributetab= ZeroOrMore('w:tab')text
attributetextstrThe textual content of this run.
Inner-content child elements like w:tab are translated to their text
equivalent.
xml
attributexmlstrXML string for this element, suitable for testing purposes.
Pretty printed for readability and without an XML declaration at the top.
Functions
add_drawing
funcadd_drawing(inline_or_anchor: CT_Inline | CT_Anchor) -> CT_DrawingReturn newly appended CT_Drawing (w:drawing) child element.
The w:drawing element has inline_or_anchor as its child.
paraminline_or_anchorCT_Inline | CT_AnchorReturns
docx.oxml.drawing.CT_Drawingadd_t
funcadd_t(text: str) -> CT_TextReturn a newly added <w:t> element containing text.
paramtextstrReturns
docx.oxml.text.run.CT_Textclear_content
funcclear_content() -> NoneRemove all child elements except a w:rPr element if present.
Returns
Nonefirst_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_comment_range_end_and_reference_below
funcinsert_comment_range_end_and_reference_below(comment_id: int) -> NoneInsert a w:commentRangeEnd and w:commentReference element after this run.
The w:commentRangeEnd element is the immediate sibling of this w:r and is followed by
a w:r containing the w:commentReference element.
paramcomment_idintReturns
Noneinsert_comment_range_start_above
funcinsert_comment_range_start_above(comment_id: int) -> NoneInsert a w:commentRangeStart element with comment_id before this run.
paramcomment_idintReturns
Noneinsert_element_before
funcinsert_element_before(elm: ElementBase, *tagnames: str)paramelmElementBaseparamtagnamesstr= ()remove_all
funcremove_all(*tagnames: str) -> NoneRemove child elements with tagname (e.g. "a:p") in tagnames.
paramtagnamesstr= ()Returns
Nonexpath
funcxpath(xpath_str: str) -> AnyOverride of lxml _Element.xpath() method.
Provides standard Open XML namespace mapping (nsmap) in centralized location.
paramxpath_strstrReturns
typing.Any