add_reply method

add_reply(author, initial, date_time, text)

Adds a reply to this comment.

def add_reply(self, author: str, initial: str, date_time: datetime.datetime, text: str):
authorstrThe author name for the reply.
initialstrThe author initials for the reply.
date_timedatetime.datetimeThe date and time for the reply.
textstrThe reply text.


Due to the existing MS Office limitations only 1 level of replies is allowed in the document.


The created Comment node for the reply.


RuntimeError (Proxy error(InvalidOperationException))Throws if this method is called on the existing Reply comment.


Shows how to add a comment to a document, and then reply to it.

doc = aw.Document()
builder = aw.DocumentBuilder(doc)

comment = aw.Comment(doc, "John Doe", "J.D.",
comment.set_text("My comment.")

# Place the comment at a node in the document's body.
# This comment will show up at the location of its paragraph,
# outside the right-side margin of the page, and with a dotted line connecting it to its paragraph.

# Add a reply, which will show up under its parent comment.
comment.add_reply("Joe Bloggs", "J.B.",, "New reply")

# Comments and replies are both Comment nodes.
self.assertEqual(2, doc.get_child_nodes(aw.NodeType.COMMENT, True).count)

# Comments that do not reply to other comments are "top-level". They have no ancestor comments.

# Replies have an ancestor top-level comment.
self.assertEqual(comment, comment.replies[0].ancestor) + "Comment.add_comment_with_reply.docx")

See Also