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

代表单元格批注。

说明

Comment 对象是 Comments 集合的成员。

示例

使用 Comment 属性可返回 Comment 对象。下例更改单元格 E5 中的批注文本。

示例代码
Worksheets.Item(1).Range("E5").Comment.Text("reviewed on " + Date())

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

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

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

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


请参阅