Comment Class

Encapsulates the object that represents a cell comment.
Inheritance Hierarchy
SystemObject
  Aspose.CellsComment

Namespace:  Aspose.Cells
Assembly:  Aspose.Cells (in Aspose.Cells.dll) Version: 22.5.0.0 (22.5.0)
Syntax
public class Comment

The Comment type exposes the following members.

Properties
  NameDescription
Public propertyCode exampleAuthor
Gets and sets Name of the original comment author
Public propertyCode exampleAutoSize
Indicates if size of comment is adjusted automatically according to its content.
Public propertyCode exampleColumn
Gets the column index of the comment.
Public propertyCode exampleCommentShape
Get a Shape object that represents the shape attached to the specified comment.
Public propertyCode exampleFont
Gets the font of comment.
Public propertyCode exampleHeight
Represents the Height of the comment, in unit of pixels.
Public propertyCode exampleHeightCM
Represents the height of the comment, in unit of centimeters.
Public propertyCode exampleHeightInch
Represents the height of the comment, in unit of inches.
Public propertyCode exampleHtmlNote
Gets and sets the html string which contains data and some formats in this comment.
Public propertyCode exampleIsThreadedComment
Indicates whether this comment is a threaded comment.
Public propertyCode exampleIsVisible
Represents if the comment is visible or not.
Public propertyCode exampleNote
Represents the content of comment.
Public propertyCode exampleRow
Gets the row index of the comment.
Public propertyCode exampleTextHorizontalAlignment
Gets and sets the text horizontal alignment type of the comment.
Public propertyCode exampleTextOrientationType
Gets and sets the text orientation type of the comment.
Public propertyCode exampleTextVerticalAlignment
Gets and sets the text vertical alignment type of the comment.
Public propertyCode exampleThreadedComments
Gets the list of threaded comments;
Public propertyCode exampleWidth
Represents the width of the comment, in unit of pixels.
Public propertyCode exampleWidthCM
Represents the width of the comment, in unit of centimeters.
Public propertyCode exampleWidthInch
Represents the width of the comment, in unit of inches.
Methods
  NameDescription
Public methodCode exampleCharacters
Returns a Characters object that represents a range of characters within the comment text.
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodFormatCharacters
Format some characters with the font setting.
Public methodCode exampleGetCharacters
Returns all Characters objects that represents a range of characters within the comment text.
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
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