Univer
Univer Sheet
功能
评论 / 批注
Facade API

Comment / Annotation Facade API 0.2.10+

完整 facade api 类型定义,请查看 FacadeAPI

示例

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);
 
// add comment to empty cell
// [Attention]: this method is async!
await range.addComment({
    dataStream: 'hello world\r\n',
});
 
// reply to current comment
// [Attention]: this method is async!
await 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

Copyright © 2021-2024 DreamNum Co,Ltd. All Rights Reserved.