MCPcopy Index your code
hub / github.com/python-openxml/python-docx / CT_Comment

Class CT_Comment

src/docx/oxml/comments.py:91–124  ·  view source on GitHub ↗

`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,

Source from the content-addressed store, hash-verified

89
90
91class CT_Comment(BaseOxmlElement):
92 """`w:comment` element, representing a single comment.
93
94 A comment is a so-called "story" and can contain paragraphs and tables much like a table-cell.
95 While probably most often used for a single sentence or phrase, a comment can contain rich
96 content, including multiple rich-text paragraphs, hyperlinks, images, and tables.
97 """
98
99 # -- attributes on `w:comment` --
100 id: int = RequiredAttribute("w:id", ST_DecimalNumber) # pyright: ignore[reportAssignmentType]
101 author: str = RequiredAttribute("w:author", ST_String) # pyright: ignore[reportAssignmentType]
102 initials: str | None = OptionalAttribute( # pyright: ignore[reportAssignmentType]
103 "w:initials", ST_String
104 )
105 date: dt.datetime | None = OptionalAttribute( # pyright: ignore[reportAssignmentType]
106 "w:date", ST_DateTime
107 )
108
109 # -- children --
110
111 p = ZeroOrMore("w:p", successors=())
112 tbl = ZeroOrMore("w:tbl", successors=())
113
114 # -- type-declarations for methods added by metaclass --
115
116 add_p: Callable[[], CT_P]
117 p_lst: list[CT_P]
118 tbl_lst: list[CT_Tbl]
119 _insert_tbl: Callable[[CT_Tbl], CT_Tbl]
120
121 @property
122 def inner_content_elements(self) -> list[CT_P | CT_Tbl]:
123 """Generate all `w:p` and `w:tbl` elements in this comment."""
124 return self.xpath("./w:p | ./w:tbl")

Callers

nothing calls this directly

Calls 3

RequiredAttributeClass · 0.90
OptionalAttributeClass · 0.90
ZeroOrMoreClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…