Interface IThreadedComments
Represents the threaded comment collection for a worksheet.
Namespace: Syncfusion.XlsIO
Assembly: Syncfusion.XlsIO.Portable.dll
Syntax
public interface IThreadedComments
Properties
Count
Gets the number of threaded comments in the threaded comment collection.
Declaration
int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of threaded comments in the IThreadedComments collection. |
Examples
The following code illustrates how to get the Count
of IThreadedComments.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Add threaded comment
IThreadedComment threadedComment = worksheet["C2"].AddThreadedComment("Hello","User");
//Get the threaded comments collection
IThreadedComments threadedComments = worksheet.ThreadedComments.
//Get the threaded comments count
int count = threadedComments.Count;
//Save and dispose
workbook.SaveAs("ThreadedComments.xlsx");
workbook.Close();
}
Item[Int32]
Gets the threaded comment from the threaded comments collection based on the specified index.
Declaration
IThreadedComment this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index of the threaded comment in the collection. |
Property Value
Type | Description |
---|---|
IThreadedComment | The IThreadedComment at the specified index. |
Examples
The following code illustrates how to access a threaded comment from the collection using a specific index.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Add threaded comment
IThreadedComment threadedComment = worksheet["C2"].AddThreadedComment("Hello","User");
//Get the threaded comments collection
IThreadedComments threadedComments = worksheet.ThreadedComments.
//Access the threaded comment from the threaded comment collection by index
string text = threadedComments[0].Text;
//Save and dispose
workbook.SaveAs("ThreadedComments.xlsx");
workbook.Close();
}
Item[Int32, Int32]
Gets the threaded comment from the threaded comments collection based on the specified row and column index.
Declaration
IThreadedComment this[int row, int column] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | row | The row index of the threaded comment |
System.Int32 | column | The column index of the threaded comment |
Property Value
Type | Description |
---|---|
IThreadedComment | The IThreadedComment at the specified row and column index, or null if the threaded comment is not found. |
Examples
The following code illustrates how to access a threaded comments from the collection using row and column index..
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Add threaded comment
IThreadedComment threadedComment = worksheet["C2"].AddThreadedComment("Hello","User");
//Get the threaded comments collection
IThreadedComments threadedComments = worksheet.ThreadedComments.
//Access the threaded comment from the threaded comment collection by row and column index
string text = threadedComments[3, 2].Text;
//Save and dispose
workbook.SaveAs("ThreadedComments.xlsx");
workbook.Close();
}
Methods
Clear()
Removes all the existing threaded comments from the threaded comments collection.
Declaration
void Clear()
Examples
The following code illustrates how to clear the threaded comments collection.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Add threaded comment
IThreadedComment threadedComment = worksheet["C2"].AddThreadedComment("Hello","User");
//Get the threaded comments collection
IThreadedComments threadedComments = worksheet.ThreadedComments.
//Removes all the threaded comments from the collection
threadedComments.Clear();
//Get the threaded comments count.
int count = threadedComments.Count; //Count is 0
//Save and dispose
workbook.SaveAs("ThreadedComments.xlsx");
workbook.Close();
}