次の方法で共有


Excel.CommentChangedEventArgs interface

既存のコメントが変更されたときに発生します。

注釈

[ API セット: ExcelApi 1.12 ]

async function registerEventHandler() {
    await Excel.run(async (context) => {
        // Register the onChanged comment event handler.
        const comments = context.workbook.worksheets.getActiveWorksheet().comments;
        comments.onChanged.add(commentChanged);
        await context.sync();
    });
}

async function commentChanged(event: Excel.CommentChangedEventArgs) {
    // Retrieve the changed comment using the comment ID.
    // Note: This function assumes only a single comment is changed at a time.
    await Excel.run(async (context) => {
        const changedComment = context.workbook.comments.getItem(event.commentDetails[0].commentId);

        // Load the changed comment's data.
        changedComment.load(["content", "authorName", "creationDate"]);
        await context.sync();

        // Print out the changed comment's data.
        console.log(`A comment was changed:`);
        console.log(`    ID: ${event.commentDetails[0].commentId}`);
        console.log(`    Updated comment content: ${changedComment.content}`);
        console.log(`    Comment author: ${changedComment.authorName}`);
        console.log(`    Creation date: ${changedComment.creationDate}`);
    });
}

プロパティ

changeType

変更されたイベントのトリガー方法を表す変更の種類を取得します。

commentDetails

関連する応答のコメント ID と ID を含む CommentDetail 配列を取得します。

source

イベントのソースを指定します。 詳細は「Excel.EventSource」をご覧ください。

type

イベントの種類を取得します。 詳細は「Excel.EventType」をご覧ください。

worksheetId

イベントが発生したワークシートの ID を取得します。

プロパティの詳細

changeType

変更されたイベントのトリガー方法を表す変更の種類を取得します。

changeType: Excel.CommentChangeType | "CommentEdited" | "CommentResolved" | "CommentReopened" | "ReplyAdded" | "ReplyDeleted" | "ReplyEdited";

プロパティ値

Excel.CommentChangeType | "CommentEdited" | "CommentResolved" | "CommentReopened" | "ReplyAdded" | "ReplyDeleted" | "ReplyEdited"

注釈

[ API セット: ExcelApi 1.12 ]

commentDetails

関連する応答のコメント ID と ID を含む CommentDetail 配列を取得します。

commentDetails: Excel.CommentDetail[];

プロパティ値

注釈

[ API セット: ExcelApi 1.12 ]

source

イベントのソースを指定します。 詳細は「Excel.EventSource」をご覧ください。

source: Excel.EventSource | "Local" | "Remote";

プロパティ値

Excel.EventSource | "Local" | "Remote"

注釈

[ API セット: ExcelApi 1.12 ]

type

イベントの種類を取得します。 詳細は「Excel.EventType」をご覧ください。

type: "CommentChanged";

プロパティ値

"CommentChanged"

注釈

[ API セット: ExcelApi 1.12 ]

worksheetId

イベントが発生したワークシートの ID を取得します。

worksheetId: string;

プロパティ値

string

注釈

[ API セット: ExcelApi 1.12 ]