Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


You can add a comment to a cell and specify the appearance. You can also resize, move, or edit the comment.
Image Removed
The following image displays the resize and move indicator icons. The resize icons are displayed when you select the comment. The move icon is displayed when the pointer is over the comment border.
Image Removed
You can lock the comment events or the comment text if the sheet options.isProtected method is set to true. The following table displays the comment property values and the result if the sheet is protected.

Locked

LockText

Result

false

false

Actions on comment take effect; the comment can be edited

true

false

Actions on comment do not take effect; the comment can be edited

false

true

Actions on comment take effect; the comment cannot be edited

true

true

Actions on comment do not take effect; the comment cannot be edited

Resizing a row or column can cause the comment's location and size to change based on the settings for the dynamicMove and dynamicSize methods. The following table displays the result of the dynamicMove and dynamicSize settings.

...

DynamicMove

...

DynamicSize

...

Result

...

true

...

true

...

Comment is moved and sized with cells

...

true

...

false

...

你可以给单元格添加批注,并指定其外观。

你也可以对批注进行移动,编辑和缩放。

Image Added

下图表示了给批注缩放和移动时指针的样式。

在批注被选中时,会在四周显示八个点,这八个点可用于缩放批注。

将鼠标移批注的边框,鼠标指针会变成移动状态,此时拖动鼠标,批注的位置就会跟着鼠标移动。

Image Added
当表格处于保护状态时(options.isProtected),你可以锁定批注的事件或者文字。

下表表示了 Locked 和 LockTest 的状态不同时,批注的不同表现:


Locked

LockText

批注的行为

false

false

可以对批注进行缩放,可以对批注进行移动,可以修改批注中的文字

true

false

不能对批注进行缩放,不能对批注进行移动,可以修改批注中的文字

false

true

不能对批注进行缩放,不能对批注进行移动,不能修改批注中的文字

true

true

不能对批注进行缩放,不能对批注进行移动,不能修改批注中的文字



行和列调整宽度和高度时可能会导致批注的位置变化(取决于 dynamicMove 和 dynamicSize 方法)。

下表描述了 dynamicMove 和 dynamicSize 的值不同时,批注的不同状态



DynamicMove

DynamicSize

批注的行为

true

true

批注会随着单元格改变位置和大小。

true

false

批注会随着单元格移动,但不会随着单元格调整大小。

false

true or false

Comment is not moved or sized with cells

You can cut, copy, or paste text in the comment if the comment is in edit mode. The comment is copied with the cell if you copy the cell.
The undo and redo actions apply if you cut, copy, or paste comment text, resize or move the comment, or change the comment's format.

Image Removed

There are some limitations when importing a comment from an Excel-formatted file. Some border styles and fonts are not imported. The comment location may be different if the sheet range is smaller than what is displayed in the original file. Comments are not imported from XLS (BIFF8) files. Comments are imported from XLSX files.

...

批注不会随着单元格移动或调整大小。



在编辑批注时,你可以复制,剪切,粘贴文字。

批注会随着单元格移动。单元格复制时会带着批注。

以下操作将计入批注的撤销和重做队列:

  1. 复制,剪切,粘贴批注中的内容;
  2. 缩放和移动批注;
  3. 改变批注的格式(Format)



Image Added

Excel 导入时的批注将会有一些限制:

  1. 边框样式无法导入
  2. 当表格区域比原文件小时,导入批注的位置将与原文件不一致。
  3. 无法从 XLS (BIFF8) 导入批注,XLSX 中的批注可以被导入。


示例代码

以下代码给单元格添加了一个批注,设置了颜色(color)和显示模式(display mode)。


JavaScript

Copy Code

var comment = activeSheet.comments.add(5,5,"new comment!");comment.text("new comment!");comment.backColor("red");comment.displayMode(GC.Spread.Sheets.Comments.DisplayMode.AlwaysShown);

 


See Also更多信息
Comment class