Excel.CommentRichContent interface

表示批注或批注答复中包含的内容。 丰富内容包含文本字符串和注释正文中包含的任何其他对象,例如提及。

注解

[ API 集:ExcelApi 1.11 ]

属性

mentions

一个数组,其中包含所有实体 (例如注释中提及) 人员。

richContent

指定注释的丰富内容 (例如,带有提及的注释内容,第一个提及的实体的 ID 属性为 0,第二个提及的实体的 ID 属性为 1) 。

属性详细信息

mentions

一个数组,其中包含所有实体 (例如注释中提及) 人员。

mentions?: Excel.CommentMention[];

属性值

注解

[ API 集:ExcelApi 1.11 ]

示例

// 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

指定注释的丰富内容 (例如,带有提及的注释内容,第一个提及的实体的 ID 属性为 0,第二个提及的实体的 ID 属性为 1) 。

richContent: string;

属性值

string

注解

[ API 集:ExcelApi 1.11 ]