Interface IThreadedComment
Represents the threaded comment for range.
Namespace: Syncfusion.XlsIO
Assembly: Syncfusion.XlsIO.Portable.dll
Syntax
public interface IThreadedComment
Properties
Author
Gets the author of the created threaded comment.
Declaration
string Author { get; }
Property Value
Type | Description |
---|---|
System.String | The author of the IThreadedComment. |
Examples
The following code illustrates how to access Author
property.
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 author
string author = threadedComment.Author;
//Save and dispose
workbook.SaveAs("ThreadedComments.xlsx");
workbook.Close();
}
ColumnIndex
Gets the column index of threaded comment.
Declaration
int ColumnIndex { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The column index of the IThreadedComment |
Examples
The following code illustrates how to access ColumnIndex
property.
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 column index of the threaded comment.
int columnIndex = threadedComment.ColumnIndex;
//Save and dispose
workbook.SaveAs("ThreadedComments.xlsx");
workbook.Close();
}
CreatedTime
Gets the creation time of the threaded comment.
Declaration
DateTime CreatedTime { get; }
Property Value
Type | Description |
---|---|
System.DateTime | The creation time of the IThreadedComment |
Examples
The following code illustrates how to access CreatedTime
property.
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 Created time
DateTime dateTime = threadedComment.CreatedTime;
//Save and dispose
workbook.SaveAs("ThreadedComments.xlsx");
workbook.Close();
}
IsResolved
Gets or sets a boolean value indicating whether this threaded comment is resolved or not.
Declaration
bool IsResolved { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if threaded comment is marked as resolved. By default, false. |
Examples
The following code illustrates how to access IsResolved
property.
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");
//Add reply threaded comment
threadedComment.AddReply("sample text", "User");
//Resolve the thread
threadedComment.IsResolved = true;
//Save and dispose
workbook.SaveAs("ThreadedComments.xlsx");
workbook.Close();
}
Replies
Gets the collection of replies from the current threaded comment.
Declaration
IThreadedComments Replies { get; }
Property Value
Type | Description |
---|---|
IThreadedComments | The collection of threaded comment replies, or null if the current threaded comment has no replies. |
Examples
The following code illustrates how to access Replies
property.
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");
//Add reply threaded comment
threadedComment.AddReply("sample text", "User");
//Access the reply threaded comment
threadedComment.Replies[0].Text = "Modified text";
//Save and dispose
workbook.SaveAs("ThreadedComments.xlsx");
workbook.Close();
}
RowIndex
Gets the row index of threaded comment.
Declaration
int RowIndex { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The row index of the IThreadedComment |
Examples
The following code illustrates how to access RowIndex
property.
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 row index of the threaded comment.
int rowIndex = threadedComment.RowIndex;
//Save and dispose
workbook.SaveAs("ThreadedComments.xlsx");
workbook.Close();
}
Text
Gets or sets the text of the threaded comment.
Declaration
string Text { get; set; }
Property Value
Type | Description |
---|---|
System.String | The text of the IThreadedComment |
Examples
The following code illustrates how to access Text
property.
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");
//Set text
threadedComment.Text = "Modified";
//Get Text
string text = threadedComment.Text;
//Save and dispose
workbook.SaveAs("ThreadedComments.xlsx");
workbook.Close();
}
Methods
AddReply(String, DateTime)
Adds a reply for existing threaded comment with the specified text.
Declaration
IThreadedComment AddReply(string text, DateTime creationTime)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | Reply threaded comment text |
System.DateTime | creationTime | Optional. The creation time of the threaded comment |
Returns
Type | Description |
---|---|
IThreadedComment | Returns the created instance of IThreadedComment. If the thread is resolved, reply threaded comment cannot be created and returns null |
Remarks
The reply threaded comment is created by mapping with author name from built-in document properties
Examples
The following code illustrates how to add reply to a threaded comment with text.
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");
//Add reply with text
threadedComment.AddReply("reply thread");
//Add reply with text and creation time
DateTime date = new DateTime(2020, 11, 22, 2, 22, 23);
threadedComment.AddReply("Text", date);
//Save and dispose
workbook.SaveAs("ThreadedComments.xlsx");
workbook.Close();
}
AddReply(String, String, DateTime)
Adds a reply for existing threaded comment with the specified text and author.
Declaration
IThreadedComment AddReply(string text, string author, DateTime creationTime)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | Reply threaded comment text |
System.String | author | The author of the reply threaded comment |
System.DateTime | creationTime | Optional. The creation time of the threaded comment |
Returns
Type | Description |
---|---|
IThreadedComment | Returns the created instance of IThreadedComment. If the thread is resolved, reply threaded comment cannot be created and returns null |
Examples
The following code illustrates how to add reply to a threaded comment with text and author.
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");
//Add reply with text and author
threadedComment.AddReply("reply thread", "User");
//Add reply with text, author and creation time
DateTime date = new DateTime(2020, 11, 22, 2, 22, 23);
threadedComment.AddReply("Text", "User", date);
//Save and dispose
workbook.SaveAs("ThreadedComments.xlsx");
workbook.Close();
}
Delete()
Deletes the threaded comment from the parent threaded comment.
Declaration
void Delete()
Examples
The following code illustrates how to Delete a threaded comment.
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");
//Delete the threaded comment from the collection.
threadedComment.Delete();
//Save and dispose
workbook.SaveAs("ThreadedComments.xlsx");
workbook.Close();
}