Comment / Annotation Facade API 0.2.10+
To get full defination of facade api, please refer to FacadeAPI
Example
const univerAPI = FUniver.newAPI(univer);
// get cell
const workbook = univerAPI.getActiveWorkbook();
const worksheet = workbook.getActiveSheet();
// comment only attch to single cell, if range is A1:J10 equal A1
const range = worksheet.getRange(0, 0, 1, 1); // A1
// add comment to empty cell
range.addComment({
dataStream: 'hello world\r\n',
});
// reply to current comment
range.addComment({
dataStream: 'reply\r\n',
});
range.clearComment();
// get comment
const comment = range.getComment();
// update content
comment?.update({
dataStream: 'hello world222\r\n',
});
// delete comment
comment?.delete();
// resolve comment
comment?.resolve();
// get replies
comment?.getReplies();
// get range of this comment
comment?.getRange();
// event
workbook.onBeforeUpdateThreadComment
workbook.onBeforeDeleteThreadComment
workbook.onBeforeAddThreadComment
// comment change event include add, update, delete
workbook.onThreadCommentChange