Class CommentCollection
Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)
Bao gồm một bộ sưu tập các đối tượng Aspose.Cells.Comment.
public class CommentCollection : CollectionBase<comment>, IList<comment>, ICollection<comment>, IEnumerable<comment>, ICollection, IEnumerable
Kế thừa
object ← CollectionBase<comment> ← CommentCollection
Triển khai
IList<comment>, ICollection<comment>, IEnumerable<comment>, ICollection, IEnumerable
Thành viên kế thừa
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()
Ví dụ
Workbook workbook = new Workbook();
CommentCollection comments = workbook.Worksheets[0].Comments;
//thực hiện công việc của bạn
Dim workbook as Workbook = new Workbook()
Dim comments as CommentCollection = workbook.Worksheets(0).Comments
Thuộc tính
this[int]
Lấy phần tử Aspose.Cells.Comment tại chỉ số được chỉ định.
public Comment this[int index] { get; }
Giá trị thuộc tính
Ví dụ
Comment comment3 = comments[0];
comment3.Note = "Ghi chú ba.";
this[string]
Lấy phần tử Aspose.Cells.Comment tại ô được chỉ định.
public Comment this[string cellName] { get; }
Giá trị thuộc tính
Ví dụ
Comment comment4 = comments["B2"];
comment4.Note = "Ghi chú bốn.";
this[int, int]
Lấy phần tử Aspose.Cells.Comment tại chỉ số hàng và chỉ số cột được chỉ định.
public Comment this[int row, int column] { get; }
Giá trị thuộc tính
Ví dụ
Comment comment5 = comments[1,1];
comment5.Note = "Ghi chú năm.";
Phương thức
Add(int, int)
Thêm một ghi chú vào bộ sưu tập.
public int Add(int row, int column)
Tham số
row
int
Chỉ số hàng của ô.
column
int
Chỉ số cột của ô.
Trả về
Chỉ số đối tượng Aspose.Cells.Comment.
Ví dụ
int commentIndex1 = comments.Add(0, 0);
Comment comment1 = comments[commentIndex1];
comment1.Note = "Ghi chú đầu tiên.";
comment1.Font.Name = "Times New Roman";
Add(string)
Thêm một ghi chú vào bộ sưu tập.
public int Add(string cellName)
Tham số
cellName
string
Tên ô.
Trả về
Chỉ số đối tượng Aspose.Cells.Comment.
Ví dụ
int commentIndex2 = comments.Add("B2");
Comment comment2 = comments[commentIndex2];
comment2.Note = "Ghi chú thứ hai.";
comment2.Font.Name = "Times New Roman";
AddThreadedComment(int, int, string, ThreadedCommentAuthor)
Thêm một ghi chú theo chuỗi.
public int AddThreadedComment(int row, int column, string text, ThreadedCommentAuthor author)
Tham số
row
int
Chỉ số hàng của ô.
column
int
Chỉ số cột của ô.
text
string
Nội dung của ghi chú.
author
ThreadedCommentAuthor
Người dùng của ghi chú theo chuỗi này.
Trả về
Chỉ số đối tượng Aspose.Cells.ThreadedComment.
AddThreadedComment(string, string, ThreadedCommentAuthor)
Thêm một ghi chú theo chuỗi.
public int AddThreadedComment(string cellName, string text, ThreadedCommentAuthor author)
Tham số
cellName
string
Tên của ô.
text
string
Nội dung của ghi chú.
author
ThreadedCommentAuthor
Người dùng của ghi chú theo chuỗi này.
Trả về
Chỉ số đối tượng Aspose.Cells.ThreadedComment.
Clear()
Xóa tất cả các ghi chú;
public void Clear()
Ví dụ
comments.Clear();
GetThreadedComments(int, int)
Lấy các ghi chú theo chuỗi theo chỉ số hàng và cột.
public ThreadedCommentCollection GetThreadedComments(int row, int column)
Tham số
row
int
Chỉ số hàng.
column
int
Chỉ số cột.
Trả về
Ví dụ
ThreadedCommentCollection threadedComments1 = comments.GetThreadedComments(1, 1);
for (int i = 0; i < threadedComments1.Count; ++i)
{
ThreadedComment tc = threadedComments1[i];
string note = tc.Notes;
}
GetThreadedComments(string)
Lấy các ghi chú theo chuỗi theo tên ô.
public ThreadedCommentCollection GetThreadedComments(string cellName)
Tham số
cellName
string
Tên của ô.
Trả về
Ví dụ
ThreadedCommentCollection threadedComments2 = comments.GetThreadedComments("B2");
for (int i = 0; i < threadedComments2.Count; ++i)
{
ThreadedComment tc = threadedComments2[i];
string note = tc.Notes;
}
RemoveAt(string)
Xóa ghi chú của ô cụ thể.
public void RemoveAt(string cellName)
Tham số
cellName
string
Tên ô chứa ghi chú.
Ví dụ
comments.RemoveAt("B2");
RemoveAt(int, int)
Xóa ghi chú của ô cụ thể.
public void RemoveAt(int row, int column)
Tham số
row
int
Chỉ số hàng.
column
int
Chỉ số cột.
Ví dụ
comments.RemoveAt(1,1);