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
Наследование
object ← CollectionBase<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 comment3 = comments[0];
comment3.Note = "Три заметки.";
this[string]
Получает элемент Aspose.Cells.Comment по указанному имени ячейки.
public Comment this[string cellName] { get; }
Значение свойства
Примеры
Comment comment4 = comments["B2"];
comment4.Note = "Четыре заметки.";
this[int, int]
Получает элемент Aspose.Cells.Comment по указанному индексу строки и индексу столбца.
public Comment this[int row, int column] { get; }
Значение свойства
Примеры
Comment comment5 = comments[1,1];
comment5.Note = "Пять заметок.";
Методы
Add(int, int)
Добавляет комментарий в коллекцию.
public int Add(int row, int column)
Параметры
row
int
Индекс строки ячейки.
column
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
Имя ячейки.
Возвращает
Индекс объекта 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
Пользователь этого потокового комментария.
Возвращает
Индекс объекта Aspose.Cells.ThreadedComment.
AddThreadedComment(string, string, ThreadedCommentAuthor)
Добавляет потоковый комментарий.
public int AddThreadedComment(string cellName, string text, ThreadedCommentAuthor author)
Параметры
cellName
string
Имя ячейки.
text
string
Текст комментария.
author
ThreadedCommentAuthor
Пользователь этого потокового комментария.
Возвращает
Индекс объекта Aspose.Cells.ThreadedComment.
Clear()
Удаляет все комментарии;
public void Clear()
Примеры
comments.Clear();
GetThreadedComments(int, int)
Получает потоковые комментарии по индексу строки и индексу столбца.
public ThreadedCommentCollection GetThreadedComments(int row, int column)
Параметры
row
int
Индекс строки.
column
int
Индекс столбца.
Возвращает
Примеры
ThreadedCommentCollection threadedComments1 = comments.GetThreadedComments(1, 1);
for (int i = 0; i < threadedComments1.Count; ++i)
{
ThreadedComment tc = threadedComments1[i];
string note = tc.Notes;
}
GetThreadedComments(string)
Получает потоковые комментарии по имени ячейки.
public ThreadedCommentCollection GetThreadedComments(string cellName)
Параметры
cellName
string
Имя ячейки.
Возвращает
Примеры
ThreadedCommentCollection threadedComments2 = comments.GetThreadedComments("B2");
for (int i = 0; i < 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);