Class CommentCollection

Class CommentCollection

Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)

封装了一组 Aspose.Cells.Comment 对象。

public class CommentCollection : CollectionBase<comment>, IList<comment>, ICollection<comment>, IEnumerable<comment>, ICollection, IEnumerable

继承

objectCollectionBase<comment>CommentCollection

实现

IList<comment>, ICollection<comment>, IEnumerable<comment>, ICollection, IEnumerable

继承成员

CollectionBase<comment>.BinarySearch(Comment), CollectionBase<comment>.BinarySearch(Comment, IComparer<comment>), CollectionBase<comment>.BinarySearch(int, int, Comment, IComparer<comment>), CollectionBase<comment>.Contains(Comment), CollectionBase<comment>.CopyTo(Comment[]), CollectionBase<comment>.CopyTo(Comment[], int), CollectionBase<comment>.CopyTo(int, Comment[], int, int), CollectionBase<comment>.Exists(Predicate<comment>), CollectionBase<comment>.Find(Predicate<comment>), CollectionBase<comment>.FindAll(Predicate<comment>), CollectionBase<comment>.FindIndex(Predicate<comment>), CollectionBase<comment>.FindIndex(int, Predicate<comment>), CollectionBase<comment>.FindIndex(int, int, Predicate<comment>), CollectionBase<comment>.FindLast(Predicate<comment>), CollectionBase<comment>.FindLastIndex(Predicate<comment>), CollectionBase<comment>.FindLastIndex(int, Predicate<comment>), CollectionBase<comment>.FindLastIndex(int, int, Predicate<comment>), CollectionBase<comment>.IndexOf(Comment), CollectionBase<comment>.IndexOf(Comment, int), CollectionBase<comment>.IndexOf(Comment, int, int), CollectionBase<comment>.LastIndexOf(Comment), CollectionBase<comment>.LastIndexOf(Comment, int), CollectionBase<comment>.LastIndexOf(Comment, int, int), CollectionBase<comment>.GetEnumerator(), CollectionBase<comment>.Clear(), CollectionBase<comment>.RemoveAt(int), CollectionBase<comment>.OnClearComplete(), CollectionBase<comment>.OnClear(), CollectionBase<comment>.Capacity, CollectionBase<comment>.Count, CollectionBase<comment>.InnerList, CollectionBase<comment>.this[int], object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

示例

Workbook workbook = new Workbook();

CommentCollection comments = workbook.Worksheets[0].Comments;

//进行您的业务
Dim workbook as Workbook = new Workbook()

Dim comments as CommentCollection = workbook.Worksheets(0).Comments

属性

this[int]

获取指定索引处的 Aspose.Cells.Comment 元素。

public Comment this[int index] { get; }

属性值

Comment

示例

Comment comment3 = comments[0];
comment3.Note = "三条备注。";

this[string]

获取指定单元格处的 Aspose.Cells.Comment 元素。

public Comment this[string cellName] { get; }

属性值

Comment

示例

Comment comment4 = comments["B2"];
comment4.Note = "四条备注。";

this[int, int]

获取指定行索引和列索引处的 Aspose.Cells.Comment 元素。

public Comment this[int row, int column] { get; }

属性值

Comment

示例

Comment comment5 = comments[1,1];
comment5.Note = "五条备注。";

方法

Add(int, int)

向集合中添加注释。

public int Add(int row, int column)

参数

row int

单元格行索引。

column int

单元格列索引。

返回

int

Aspose.Cells.Comment 对象索引。

示例

int commentIndex1 = comments.Add(0, 0);
Comment comment1 = comments[commentIndex1];
comment1.Note = "第一条备注。";
comment1.Font.Name = "Times New Roman";

Add(string)

向集合中添加注释。

public int Add(string cellName)

参数

cellName string

单元格名称。

返回

int

Aspose.Cells.Comment 对象索引。

示例

int commentIndex2 = comments.Add("B2");
Comment comment2 = comments[commentIndex2];
comment2.Note = "第二条备注。";
comment2.Font.Name = "Times New Roman";

AddThreadedComment(int, int, string, ThreadedCommentAuthor)

添加一个线程注释。

public int AddThreadedComment(int row, int column, string text, ThreadedCommentAuthor author)

参数

row int

单元格行索引。

column int

单元格列索引。

text string

注释的文本。

author ThreadedCommentAuthor

此线程注释的用户。

返回

int

Aspose.Cells.ThreadedComment 对象索引。

AddThreadedComment(string, string, ThreadedCommentAuthor)

添加一个线程注释。

public int AddThreadedComment(string cellName, string text, ThreadedCommentAuthor author)

参数

cellName string

单元格名称。

text string

注释的文本。

author ThreadedCommentAuthor

此线程注释的用户。

返回

int

Aspose.Cells.ThreadedComment 对象索引。

Clear()

移除所有注释;

public void Clear()

示例

comments.Clear();

GetThreadedComments(int, int)

通过行和列索引获取线程注释。

public ThreadedCommentCollection GetThreadedComments(int row, int column)

参数

row int

行索引。

column int

列索引。

返回

ThreadedCommentCollection

示例

ThreadedCommentCollection threadedComments1 = comments.GetThreadedComments(1, 1);
for (int i = 0; i &lt; threadedComments1.Count; ++i)
{
    ThreadedComment tc = threadedComments1[i];
    string note = tc.Notes;
}

GetThreadedComments(string)

通过单元格名称获取线程注释。

public ThreadedCommentCollection GetThreadedComments(string cellName)

参数

cellName string

单元格名称。

返回

ThreadedCommentCollection

示例

ThreadedCommentCollection threadedComments2 = comments.GetThreadedComments("B2");
for (int i = 0; i &lt; threadedComments2.Count; ++i)
{
    ThreadedComment tc = threadedComments2[i];
    string note = tc.Notes;
}

RemoveAt(string)

移除特定单元格的注释。

public void RemoveAt(string cellName)

参数

cellName string

包含注释的单元格名称。

示例

comments.RemoveAt("B2");

RemoveAt(int, int)

移除特定单元格的注释。

public void RemoveAt(int row, int column)

参数

row int

行索引。

column int

列索引。

示例

comments.RemoveAt(1,1);
 中文