WPS 基础接口 > 表格 API 参考 > Comments > Comments 对象

由单元格批注组成的集合。

说明

每个批注都由一个 Comment 对象代表。

示例

使用 Comments 属性可返回 Comments 集合。下例隐藏第一张工作表中的所有批注。

示例代码
let cmt = Worksheets.Item(1).Comments
for(let c = 1;c <= cmt.Count;c++) {
    cmt.Item(c).Visible = false
}

使用 AddComment 方法可在区域内添加批注。下例在第一张工作表的单元格 E5 中添加批注。

示例代码
let myComment = Worksheets.Item(1).Range("E5").AddComment()
    myComment.Visible = false
    myComment.Text("reviewed on " + Date())

使用 Comments(index)(其中 index 为批注号)可返回 Comments 集合中的单条批注。下例隐藏第一张工作表中的第二条批注。

示例代码
Worksheets.Item(1).Comments.Item(2).Visible = false


请参阅