[]
        
首页
开发者学堂
文档
论坛
市场
生态机会
活动
立即试用
(Showing Draft Content)

IComments

Interface IComments

All Superinterfaces:
Iterable<IComment>

public interface IComments extends Iterable<IComment>
表示单元格注释集合。

集合中的每个注释都由 IComment 对象表示。使用此接口可以访问和枚举工作表中的注释。


 worksheet.getRange("B2").addComment("Review this value");
 IComments comments = worksheet.getComments();
 IComment comment = comments.get(0);
 
  • Method Summary

    Modifier and Type
    Method
    Description
    get(int index)
    获取指定索引处的注释。
    int
    返回集合中的注释对象数量。

    Methods inherited from interface java.lang.Iterable

    forEach, iterator, spliterator
  • Method Details

    • get

      IComment get(int index)
      获取指定索引处的注释。

      使用此方法可以从此 IComments 集合(例如 IWorksheet.getComments() 返回的集合)中检索 IComment 对象。

      
       worksheet.getRange("B2").addComment("Review this value");
       IComments comments = worksheet.getComments();
       IComment comment = comments.get(0);
       
      Parameters:
      index - 注释在集合中的从零开始的索引。
      Returns:
      指定索引处的 IComment 对象。如果索引小于 0 或大于等于 getCount(),则返回 null。
    • getCount

      int getCount()
      返回集合中的注释对象数量。

      此值表示此 IComments 集合中包含多少个 IComment 对象,例如 IWorksheet.getComments() 返回的集合。

      
       worksheet.getRange("A1").addComment("Name is required.");
       worksheet.getRange("B2").addComment("Enter a value.");
       IComments comments = worksheet.getComments();
       int count = comments.getCount();
       
      Returns:
      集合中的注释对象数量。