Paper Office
paper-docxAPI referenceoxml.comments

CT_Comment

paper-docx 0.2.0 API reference

w:comment element, representing a single comment.

A comment is a so-called "story" and can contain paragraphs and tables much like a table-cell. While probably most often used for a single sentence or phrase, a comment can contain rich content, including multiple rich-text paragraphs, hyperlinks, images, and tables.

Attributes

add_p

attributeadd_pCallable[[], CT_P]

author

attributeauthorstr
= RequiredAttribute('w:author', ST_String)

date

attributedatedt.datetime | None
= OptionalAttribute('w:date', ST_DateTime)

id

attributeidint
= RequiredAttribute('w:id', ST_DecimalNumber)

initials

attributeinitialsstr | None
= OptionalAttribute('w:initials', ST_String)

inner_content_elements

attributeinner_content_elementslist[CT_P | CT_Tbl]

Generate all w:p and w:tbl elements in this comment.

p

attributep
= ZeroOrMore('w:p', successors=())

p_lst

attributep_lstlist[CT_P]

tbl

attributetbl
= ZeroOrMore('w:tbl', successors=())

tbl_lst

attributetbl_lstlist[CT_Tbl]

xml

attributexmlstr

XML string for this element, suitable for testing purposes.

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

Functions

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