Class CommentCollection

Class CommentCollection

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

Encapsulates a collection of Aspose.Cells.Comment objects.

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

Inheritance

objectCollectionBase<comment>CommentCollection

Implements

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

Inherited Members

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()

Examples

Workbook workbook = new Workbook();

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

//do your business
Dim workbook as Workbook = new Workbook()

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

Properties

this[int]

Gets the Aspose.Cells.Comment element at the specified index.

public Comment this[int index] { get; }

Property Value

Comment

Examples

csharp
[C#]
Comment comment3 = comments[0];
comment3.Note = "Three note.";

this[string]

Gets the Aspose.Cells.Comment element at the specified cell.

public Comment this[string cellName] { get; }

Property Value

Comment

Examples

csharp
[C#]
Comment comment4 = comments["B2"];
comment4.Note = "Four note.";

this[int, int]

Gets the Aspose.Cells.Comment element at the specified row index and column index.

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

Property Value

Comment

Examples

csharp
[C#]
Comment comment5 = comments[1,1];
comment5.Note = "Five note.";

Methods

Add(int, int)

Adds a comment to the collection.

public int Add(int row, int column)

Parameters

row int

Cell row index.

column int

Cell column index.

Returns

int

Aspose.Cells.Comment object index.

Examples

csharp
[C#]
int commentIndex1 = comments.Add(0, 0);
Comment comment1 = comments[commentIndex1];
comment1.Note = "First note.";
comment1.Font.Name = "Times New Roman";

Add(string)

Adds a comment to the collection.

public int Add(string cellName)

Parameters

cellName string

Cell name.

Returns

int

Aspose.Cells.Comment object index.

Examples

csharp
[C#]
int commentIndex2 = comments.Add("B2");
Comment comment2 = comments[commentIndex2];
comment2.Note = "Second note.";
comment2.Font.Name = "Times New Roman";

AddThreadedComment(int, int, string, ThreadedCommentAuthor)

Adds a threaded comment.

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

Parameters

row int

Cell row index.

column int

Cell column index.

text string

The text of the comment

author ThreadedCommentAuthor

The user of this threaded comment.

Returns

int

Aspose.Cells.ThreadedComment object index.

AddThreadedComment(string, string, ThreadedCommentAuthor)

Adds a threaded comment.

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

Parameters

cellName string

The name of the cell.

text string

The text of the comment

author ThreadedCommentAuthor

The user of this threaded comment.

Returns

int

Aspose.Cells.ThreadedComment object index.

Clear()

Removes all comments;

public void Clear()

Examples

csharp
[C#]
comments.Clear();

GetThreadedComments(int, int)

Gets the threaded comments by row and column index.

public ThreadedCommentCollection GetThreadedComments(int row, int column)

Parameters

row int

The row index.

column int

The column index.

Returns

ThreadedCommentCollection

Examples

csharp
[C#]
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)

Gets the threaded comments by cell name.

public ThreadedCommentCollection GetThreadedComments(string cellName)

Parameters

cellName string

The name of the cell.

Returns

ThreadedCommentCollection

Examples

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

RemoveAt(string)

Removes the comment of the specific cell.

public void RemoveAt(string cellName)

Parameters

cellName string

The name of cell which contains a comment.

Examples

csharp
[C#]
comments.RemoveAt("B2");

RemoveAt(int, int)

Removes the comment of the specific cell.

public void RemoveAt(int row, int column)

Parameters

row int

The row index.

column int

the column index.

Examples

csharp
[C#]
comments.RemoveAt(1,1);

</comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment>