CT_Comments
paper-docx 0.2.0 API reference
w:comments element, the root element for the comments part.
Simply contains a collection of w:comment elements, each representing a single comment. Each
contained comment is identified by a unique w:id attribute, used to reference the comment
from the document text. The offset of the comment in this collection is arbitrary; it is
essentially a set implemented as a list.
Attributes
comment
attributecomment= ZeroOrMore('w:comment')comment_lst
attributecomment_lstlist[CT_Comment]xml
attributexmlstrXML string for this element, suitable for testing purposes.
Pretty printed for readability and without an XML declaration at the top.
Functions
add_comment
funcadd_comment() -> CT_CommentReturn newly added w:comment child of this w:comments.
The returned w:comment element is the minimum valid value, having a w:id value unique
within the existing comments and the required w:author attribute present but set to the
empty string. It's content is limited to a single run containing the necessary annotation
reference but no text. Content is added by adding runs to this first paragraph and by
adding additional paragraphs as needed.
Returns
docx.oxml.comments.CT_Commentfirst_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 | Noneget_comment_by_id
funcget_comment_by_id(comment_id: int) -> CT_Comment | NoneReturn the w:comment element identified by comment_id, or None if not found.
paramcomment_idintReturns
docx.oxml.comments.CT_Comment | 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