Excel.CommentChangedEventArgs interface
更改现有注释时发生。
注解
示例
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}`);
});
}
属性
| change |
获取表示更改事件的触发方式的更改类型。 |
| comment |
|
| source | 指定时间源。 有关详细信息,请参阅 |
| type | 获取事件的类型。 有关详细信息,请参阅 |
| worksheet |
获取发生事件的工作表的 ID。 |
属性详细信息
changeType
获取表示更改事件的触发方式的更改类型。
changeType: Excel.CommentChangeType | "CommentEdited" | "CommentResolved" | "CommentReopened" | "ReplyAdded" | "ReplyDeleted" | "ReplyEdited";
属性值
Excel.CommentChangeType | "CommentEdited" | "CommentResolved" | "CommentReopened" | "ReplyAdded" | "ReplyDeleted" | "ReplyEdited"
注解
commentDetails
CommentDetail获取包含其相关答复的注释 ID 和 ID 的数组。
commentDetails: Excel.CommentDetail[];
属性值
注解
source
指定时间源。 有关详细信息,请参阅 Excel.EventSource。
source: Excel.EventSource | "Local" | "Remote";
属性值
Excel.EventSource | "Local" | "Remote"
注解
type
获取事件的类型。 有关详细信息,请参阅 Excel.EventType。
type: "CommentChanged";
属性值
"CommentChanged"