Class Comment

Comment class

Encapsulates the object that represents a cell comment.

public class Comment

Properties

NameDescription
Author { get; set; }Gets and sets Name of the original comment author
AutoSize { get; set; }Indicates if size of comment is adjusted automatically according to its content.
Column { get; }Gets the column index of the comment.
CommentShape { get; }Get a Shape object that represents the shape attached to the specified comment.
Font { get; }Gets the font of comment.
Height { get; set; }Represents the Height of the comment, in unit of pixels.
HeightCM { get; set; }Represents the height of the comment, in unit of centimeters.
HeightInch { get; set; }Represents the height of the comment, in unit of inches.
HtmlNote { get; set; }Gets and sets the html string which contains data and some formats in this comment.
IsThreadedComment { get; }Indicates whether this comment is a threaded comment.
IsVisible { get; set; }Represents if the comment is visible or not.
Note { get; set; }Represents the content of comment.
Row { get; }Gets the row index of the comment.
TextHorizontalAlignment { get; set; }Gets and sets the text horizontal alignment type of the comment.
TextOrientationType { get; set; }Gets and sets the text orientation type of the comment.
TextVerticalAlignment { get; set; }Gets and sets the text vertical alignment type of the comment.
ThreadedComments { get; }Gets the list of threaded comments;
Width { get; set; }Represents the width of the comment, in unit of pixels.
WidthCM { get; set; }Represents the width of the comment, in unit of centimeters.
WidthInch { get; set; }Represents the width of the comment, in unit of inches.

Methods

NameDescription
Characters(int, int)Returns a Characters object that represents a range of characters within the comment text.
FormatCharacters(int, int, Font, StyleFlag)Format some characters with the font setting.
GetCharacters()(Obsolete.) Returns all Characters objects that represents a range of characters within the comment text.
GetRichFormattings()Returns all Characters objects that represents a range of characters within the comment text.

Examples

[C#]

Workbook workbook = new Workbook();
CommentCollection comments = workbook.Worksheets[0].Comments;

//Add comment to cell A1
int commentIndex1 = comments.Add(0, 0);
Comment comment1 = comments[commentIndex1];
comment1.Note = "First note.";
comment1.Font.Name = "Times New Roman";

//Add comment to cell B2
comments.Add("B2");
Comment comment2 = comments["B2"];
comment2.Note = "Second note.";

//do your business

//Save the excel file.
workbook.Save("exmaple.xlsx");

[Visual Basic]

Dim workbook as Workbook = new Workbook()
Dim comments as CommentCollection = workbook.Worksheets(0).Comments
 
'Add comment to cell A1
Dim commentIndex1 as Integer = comments.Add(0, 0)
Dim comment1 as Comment = comments(commentIndex1)
comment1.Note = "First note."
comment1.Font.Name = "Times New Roman"

'Add comment to cell B2
comments.Add("B2")
Dim comment2 As Comment = comments("B2")
comment2.Note = "Second note."
 

See Also