Excel.CommentChangedEventArgs interface
Occurs when existing comments are changed.
Remarks
Examples
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}`);
});
}
Properties
| change |
Gets the change type that represents how the changed event is triggered. |
| comment |
Get the |
| source | Specifies the source of the event. See |
| type | Gets the type of the event. See |
| worksheet |
Gets the ID of the worksheet in which the event happened. |
Property Details
changeType
Gets the change type that represents how the changed event is triggered.
changeType: Excel.CommentChangeType | "CommentEdited" | "CommentResolved" | "CommentReopened" | "ReplyAdded" | "ReplyDeleted" | "ReplyEdited";
Property Value
Excel.CommentChangeType | "CommentEdited" | "CommentResolved" | "CommentReopened" | "ReplyAdded" | "ReplyDeleted" | "ReplyEdited"
Remarks
commentDetails
Get the CommentDetail array which contains the comment ID and IDs of its related replies.
commentDetails: Excel.CommentDetail[];
Property Value
Remarks
source
Specifies the source of the event. See Excel.EventSource for details.
source: Excel.EventSource | "Local" | "Remote";
Property Value
Excel.EventSource | "Local" | "Remote"
Remarks
type
Gets the type of the event. See Excel.EventType for details.
type: "CommentChanged";
Property Value
"CommentChanged"
Remarks
worksheetId
Gets the ID of the worksheet in which the event happened.
worksheetId: string;
Property Value
string