ExcelScript.CommentMention interface

コメントに記載されているエンティティを表します。

注釈

/**
 * This sample creates a comment that mentions a specific person.
 * That person will get a notification and link to the workbook.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the first cell in the current worksheet.
  const currentSheet = workbook.getActiveWorksheet();
  const cell = currentSheet.getCell(0,0);
  
  /* Create a CommentMention object for the comment.
   *
   * A CommentMention's properties are:
   * `name`: The name of the person being mentioned.
   * `id`: The zero-based index of this mention in the comment.
   * `email`: The email address of the person being mentioned. 
   */
  const mention: ExcelScript.CommentMention = {
    name: "Alex",
    id: 0,
    email: "alex@contoso.com"
  };

  /* Create comment content that uses the mention. 
   * The `<at id="0">` syntax embeds the mention with ID 0 in the comment text. 
   * The name is displayed in the comment, 
   * while an email is sent to the given address.
   */
  const content: ExcelScript.CommentRichContent = {
    richContent: '<at id="0">' + mention.name + "</at> - Hello!",
    mentions: [mention]
  };

  // Add the comment.
  currentSheet.addComment(cell, content, ExcelScript.ContentType.mention);
}

プロパティ

email

コメントに記載されているエンティティの電子メール アドレス。

id

エンティティの ID。 ID は、 内のいずれかの ID と一致します CommentRichContent.richContent

name

コメントに記載されているエンティティの名前。

プロパティの詳細

email

コメントに記載されているエンティティの電子メール アドレス。

email: string;

プロパティ値

string

id

エンティティの ID。 ID は、 内のいずれかの ID と一致します CommentRichContent.richContent

id: number;

プロパティ値

number

name

コメントに記載されているエンティティの名前。

name: string;

プロパティ値

string