ThreadedCommentAuthorCollection.Item
Contents
[
Hide
]ThreadedCommentAuthorCollection indexer (1 of 2)
Gets the person who create threaded comments.
public ThreadedCommentAuthor this[int index] { get; }
| Parameter | Description |
|---|---|
| index | The index |
Examples
using System;
using Aspose.Cells;
namespace AsposeCellsExamples
{
public class ThreadedCommentAuthorCollectionPropertyItemDemo
{
public static void Run()
{
Workbook workbook = new Workbook();
ThreadedCommentAuthorCollection authors = workbook.Worksheets.ThreadedCommentAuthors;
// Add authors and demonstrate Item property usage
authors.Add("John Doe", "john.doe@example.com", "JD");
authors.Add("Jane Smith", "jane.smith@example.com", "JS");
// Access author using Item property
ThreadedCommentAuthor firstAuthor = authors[0];
Console.WriteLine($"First author: {firstAuthor.Name}, {firstAuthor.UserId}");
// Set current person using Item property
authors.CurrentPerson = authors[1];
Console.WriteLine($"Current person: {authors.CurrentPerson.Name}");
// Add threaded comments
CommentCollection comments = workbook.Worksheets[0].Comments;
comments.AddThreadedComment("A1", "Comment from " + authors[0].Name, authors[0]);
comments.AddThreadedComment("A1", "Reply from " + authors[1].Name, authors[1]);
workbook.Save("ThreadedCommentAuthorsDemo.xlsx");
}
}
}
See Also
- class ThreadedCommentAuthor
- class ThreadedCommentAuthorCollection
- namespace Aspose.Cells
- assembly Aspose.Cells
ThreadedCommentAuthorCollection indexer (2 of 2)
Gets the person who create threaded comments.
public ThreadedCommentAuthor this[string name] { get; }
| Parameter | Description |
|---|---|
| name | The name of the author. |
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using System;
public class ThreadedCommentAuthorCollectionPropertyItemDemo1
{
public static void Run()
{
// Create a new workbook
Workbook workbook = new Workbook();
try
{
// Access the ThreadedCommentAuthorCollection
ThreadedCommentAuthorCollection authors = workbook.Worksheets.ThreadedCommentAuthors;
// Add some authors to demonstrate the Item property
authors.Add("John Doe", "john.doe@example.com", "JD");
authors.Add("Jane Smith", "jane.smith@example.com", "JS");
// Access authors using the Item property (indexer)
ThreadedCommentAuthor firstAuthor = authors[0];
ThreadedCommentAuthor secondAuthor = authors[1];
// Display the author information retrieved via Item property
Console.WriteLine($"First author: {firstAuthor.Name}, {firstAuthor.UserId}");
Console.WriteLine($"Second author: {secondAuthor.Name}, {secondAuthor.UserId}");
// Set current person using one of the authors accessed via Item property
authors.CurrentPerson = authors[0];
Console.WriteLine($"Current person set to: {authors.CurrentPerson.Name}");
// Save the workbook
workbook.Save("ThreadedCommentAuthorsItemDemo.xlsx");
Console.WriteLine("Workbook saved successfully.");
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
}
}
See Also
- class ThreadedCommentAuthor
- class ThreadedCommentAuthorCollection
- namespace Aspose.Cells
- assembly Aspose.Cells