Excel.CommentAddedEventArgs interface
コメント追加イベントを発生させたコメントに関する情報を提供します。
注釈
例
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}`);
});
}
プロパティ
| comment |
関連する応答のコメント ID と ID を含む |
| source | イベントのソースを指定します。 詳細は「 |
| type | イベントの種類を取得します。 詳細は「 |
| worksheet |
イベントが発生したワークシートの ID を取得します。 |
プロパティの詳細
commentDetails
関連する応答のコメント ID と ID を含む CommentDetail 配列を取得します。
commentDetails: Excel.CommentDetail[];
プロパティ値
注釈
source
イベントのソースを指定します。 詳細は「Excel.EventSource」をご覧ください。
source: Excel.EventSource | "Local" | "Remote";
プロパティ値
Excel.EventSource | "Local" | "Remote"
注釈
type
イベントの種類を取得します。 詳細は「Excel.EventType」をご覧ください。
type: "CommentAdded";
プロパティ値
"CommentAdded"