Return 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 limite
(self)
| 30 | comment = ZeroOrMore("w:comment") |
| 31 | |
| 32 | def add_comment(self) -> CT_Comment: |
| 33 | """Return newly added `w:comment` child of this `w:comments`. |
| 34 | |
| 35 | The returned `w:comment` element is the minimum valid value, having a `w:id` value unique |
| 36 | within the existing comments and the required `w:author` attribute present but set to the |
| 37 | empty string. It's content is limited to a single run containing the necessary annotation |
| 38 | reference but no text. Content is added by adding runs to this first paragraph and by |
| 39 | adding additional paragraphs as needed. |
| 40 | """ |
| 41 | next_id = self._next_available_comment_id() |
| 42 | comment = cast( |
| 43 | CT_Comment, |
| 44 | parse_xml( |
| 45 | f'<w:comment {nsdecls("w")} w:id="{next_id}" w:author="">' |
| 46 | f" <w:p>" |
| 47 | f" <w:pPr>" |
| 48 | f' <w:pStyle w:val="CommentText"/>' |
| 49 | f" </w:pPr>" |
| 50 | f" <w:r>" |
| 51 | f" <w:rPr>" |
| 52 | f' <w:rStyle w:val="CommentReference"/>' |
| 53 | f" </w:rPr>" |
| 54 | f" <w:annotationRef/>" |
| 55 | f" </w:r>" |
| 56 | f" </w:p>" |
| 57 | f"</w:comment>" |
| 58 | ), |
| 59 | ) |
| 60 | self.append(comment) |
| 61 | return comment |
| 62 | |
| 63 | def get_comment_by_id(self, comment_id: int) -> CT_Comment | None: |
| 64 | """Return the `w:comment` element identified by `comment_id`, or |None| if not found.""" |
nothing calls this directly
no test coverage detected