通过


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

CommentDetail获取包含其相关答复的注释 ID 和 ID 的数组。

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

CommentDetail获取包含其相关答复的注释 ID 和 ID 的数组。

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 ]