Excel.CommentAddedEventArgs interface
Stellt Informationen zu den Kommentaren bereit, die das Ereignis "Kommentar hinzugefügt" ausgelöst haben.
Hinweise
Beispiele
async function registerEventHandler() {
await Excel.run(async (context) => {
// Register the onAdded comment event handler.
const comments = context.workbook.worksheets.getActiveWorksheet().comments;
comments.onAdded.add(commentAdded);
await context.sync();
});
}
async function commentAdded(event: Excel.CommentAddedEventArgs) {
// Retrieve the added comment using the comment ID.
// Note: This function assumes only a single comment is added at a time.
await Excel.run(async (context) => {
const addedComment = context.workbook.comments.getItem(event.commentDetails[0].commentId);
// Load the added comment's data.
addedComment.load(["content", "authorName", "creationDate"]);
await context.sync();
// Print out the added comment's data.
console.log(`A comment was added:`);
console.log(` ID: ${event.commentDetails[0].commentId}`);
console.log(` Comment content: ${addedComment.content}`);
console.log(` Comment author: ${addedComment.authorName}`);
console.log(` Creation date: ${addedComment.creationDate}`);
});
}
Eigenschaften
| comment |
Ruft das |
| source | Gibt die Quelle des Ereignisses an. Weitere Informationen finden Sie unter |
| type | Ruft den Typ des Ereignisses ab. Weitere Informationen finden Sie unter |
| worksheet |
Ruft die ID des Arbeitsblatts ab, in dem das Ereignis aufgetreten ist. |
Details zur Eigenschaft
commentDetails
Ruft das CommentDetail Array ab, das die Kommentar-ID und die IDs der zugehörigen Antworten enthält.
commentDetails: Excel.CommentDetail[];
Eigenschaftswert
Hinweise
source
Gibt die Quelle des Ereignisses an. Weitere Informationen finden Sie unter Excel.EventSource .
source: Excel.EventSource | "Local" | "Remote";
Eigenschaftswert
Excel.EventSource | "Local" | "Remote"
Hinweise
type
Ruft den Typ des Ereignisses ab. Weitere Informationen finden Sie unter Excel.EventType .
type: "CommentAdded";
Eigenschaftswert
"CommentAdded"
Hinweise
worksheetId
Ruft die ID des Arbeitsblatts ab, in dem das Ereignis aufgetreten ist.
worksheetId: string;
Eigenschaftswert
string