Excel.CommentRichContent interface
Represents the content contained within a comment or comment reply. Rich content incudes the text string and any other objects contained within the comment body, such as mentions.
Remarks
Properties
mentions | An array containing all the entities (e.g., people) mentioned within the comment. |
rich |
Specifies the rich content of the comment (e.g., comment content with mentions, the first mentioned entity has an ID attribute of 0, and the second mentioned entity has an ID attribute of 1). |
Property Details
mentions
An array containing all the entities (e.g., people) mentioned within the comment.
mentions?: Excel.CommentMention[];
Property Value
Remarks
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/12-comment/comment-mentions.yaml
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem("Comments");
const mention = {
email: "kakri@contoso.com",
id: 0,
name: "Kate Kristensen"
};
// This will tag the mention's name using the '@' syntax.
// They will be notified via email.
const commentBody = {
mentions: [mention],
richContent: '<at id="0">' + mention.name + "</at> - Can you take a look?"
};
// Note that an InvalidArgument error will be thrown if multiple cells passed to `comment.add`.
sheet.comments.add("A1", commentBody, Excel.ContentType.mention);
await context.sync();
});
richContent
Specifies the rich content of the comment (e.g., comment content with mentions, the first mentioned entity has an ID attribute of 0, and the second mentioned entity has an ID attribute of 1).
richContent: string;
Property Value
string
Remarks
Office Add-ins