Skip to main content

Add a comment

A comment anchors to a range or a paragraph.
The author is doc.revisionAuthor.

Comment across paragraphs

Join two ranges with expandTo. The comment opens in the first paragraph and closes in the last.
Both ranges must be in the same story. A body range and a footer range cannot share a comment.

Comment on a tracked change

A deletion’s range holds its struck text, as in Word. Its text is empty, but isEmpty is false. Join it to the insertion that replaces it to comment on the whole change.
A range that starts or ends on a deletion keeps the struck text for insertComment, font, delete, getOoxml, getTrackedChanges and compareLocationWith. insertText at its Start, a tracked Replace and insertParagraph("Before") go before the struck text.

Read comments

A range, a paragraph and the body also have getComments() for the comments inside them.

Reply, resolve and delete

delete() also removes the replies and the anchors in the text.

Show comments in a PDF

Comments then show in a margin to the right of each page, as Word prints them.