Comment
Comment class
Encapsulates the object that represents a cell comment.
class Comment;
Example
const { Workbook } = require("aspose.cells.node");
var workbook = new Workbook();
var comments = workbook.worksheets.get(0).comments;
//Add comment to cell A1
var commentIndex = comments.add(0, 0);
var comment = comments.get(commentIndex);
comment.note = "First note.";
comment.font.setName("Times New Roman");
//Add comment to cell B2
comments.add("B2");
comment = comments.get("B2");
comment.note = "Second note.";
Properties
| Property | Type | Description | 
|---|---|---|
| author | string | Gets and sets Name of the original comment author | 
| commentShape | CommentShape | Readonly. Get a Shape object that represents the shape attached to the specified comment. | 
| row | number | Readonly. Gets the row index of the comment. | 
| column | number | Readonly. Gets the column index of the comment. | 
| isThreadedComment | boolean | Readonly. Indicates whether this comment is a threaded comment. | 
| threadedComments | ThreadedCommentCollection | Readonly. Gets the list of threaded comments; | 
| note | string | Represents the content of comment. | 
| htmlNote | string | Gets and sets the html string which contains data and some formats in this comment. | 
| font | Font | Readonly. Gets the font of comment. | 
| isVisible | boolean | Represents if the comment is visible or not. | 
| textOrientationType | TextOrientationType | Gets and sets the text orientation type of the comment. | 
| textHorizontalAlignment | TextAlignmentType | Gets and sets the text horizontal alignment type of the comment. | 
| textVerticalAlignment | TextAlignmentType | Gets and sets the text vertical alignment type of the comment. | 
| autoSize | boolean | Indicates if size of comment is adjusted automatically according to its content. Note: In some special cases (such as Mac environment), this setting may not take effect. If this setting does not take effect, please replace it with FitToTextSize(). | 
| heightCM | number | Represents the height of the comment, in unit of centimeters. | 
| widthCM | number | Represents the width of the comment, in unit of centimeters. | 
| width | number | Represents the width of the comment, in unit of pixels. | 
| height | number | Represents the Height of the comment, in unit of pixels. | 
| widthInch | number | Represents the width of the comment, in unit of inches. | 
| heightInch | number | Represents the height of the comment, in unit of inches. | 
Methods
| Method | Description | 
|---|---|
| getAuthor() | @deprecated. Please use the ‘author’ property instead. Gets and sets Name of the original comment author | 
| setAuthor(string) | @deprecated. Please use the ‘author’ property instead. Gets and sets Name of the original comment author | 
| getCommentShape() | @deprecated. Please use the ‘commentShape’ property instead. Get a Shape object that represents the shape attached to the specified comment. | 
| getRow() | @deprecated. Please use the ‘row’ property instead. Gets the row index of the comment. | 
| getColumn() | @deprecated. Please use the ‘column’ property instead. Gets the column index of the comment. | 
| isThreadedComment() | @deprecated. Please use the ‘isThreadedComment’ property instead. Indicates whether this comment is a threaded comment. | 
| getThreadedComments() | @deprecated. Please use the ’threadedComments’ property instead. Gets the list of threaded comments; | 
| getNote() | @deprecated. Please use the ’note’ property instead. Represents the content of comment. | 
| setNote(string) | @deprecated. Please use the ’note’ property instead. Represents the content of comment. | 
| getHtmlNote() | @deprecated. Please use the ‘htmlNote’ property instead. Gets and sets the html string which contains data and some formats in this comment. | 
| setHtmlNote(string) | @deprecated. Please use the ‘htmlNote’ property instead. Gets and sets the html string which contains data and some formats in this comment. | 
| getFont() | @deprecated. Please use the ‘font’ property instead. Gets the font of comment. | 
| isVisible() | @deprecated. Please use the ‘isVisible’ property instead. Represents if the comment is visible or not. | 
| setIsVisible(boolean) | @deprecated. Please use the ‘isVisible’ property instead. Represents if the comment is visible or not. | 
| getTextOrientationType() | @deprecated. Please use the ’textOrientationType’ property instead. Gets and sets the text orientation type of the comment. | 
| setTextOrientationType(TextOrientationType) | @deprecated. Please use the ’textOrientationType’ property instead. Gets and sets the text orientation type of the comment. | 
| getTextHorizontalAlignment() | @deprecated. Please use the ’textHorizontalAlignment’ property instead. Gets and sets the text horizontal alignment type of the comment. | 
| setTextHorizontalAlignment(TextAlignmentType) | @deprecated. Please use the ’textHorizontalAlignment’ property instead. Gets and sets the text horizontal alignment type of the comment. | 
| getTextVerticalAlignment() | @deprecated. Please use the ’textVerticalAlignment’ property instead. Gets and sets the text vertical alignment type of the comment. | 
| setTextVerticalAlignment(TextAlignmentType) | @deprecated. Please use the ’textVerticalAlignment’ property instead. Gets and sets the text vertical alignment type of the comment. | 
| getAutoSize() | @deprecated. Please use the ‘autoSize’ property instead. Indicates if size of comment is adjusted automatically according to its content. Note: In some special cases (such as Mac environment), this setting may not take effect. If this setting does not take effect, please replace it with FitToTextSize(). | 
| setAutoSize(boolean) | @deprecated. Please use the ‘autoSize’ property instead. Indicates if size of comment is adjusted automatically according to its content. Note: In some special cases (such as Mac environment), this setting may not take effect. If this setting does not take effect, please replace it with FitToTextSize(). | 
| getHeightCM() | @deprecated. Please use the ‘heightCM’ property instead. Represents the height of the comment, in unit of centimeters. | 
| setHeightCM(number) | @deprecated. Please use the ‘heightCM’ property instead. Represents the height of the comment, in unit of centimeters. | 
| getWidthCM() | @deprecated. Please use the ‘widthCM’ property instead. Represents the width of the comment, in unit of centimeters. | 
| setWidthCM(number) | @deprecated. Please use the ‘widthCM’ property instead. Represents the width of the comment, in unit of centimeters. | 
| getWidth() | @deprecated. Please use the ‘width’ property instead. Represents the width of the comment, in unit of pixels. | 
| setWidth(number) | @deprecated. Please use the ‘width’ property instead. Represents the width of the comment, in unit of pixels. | 
| getHeight() | @deprecated. Please use the ‘height’ property instead. Represents the Height of the comment, in unit of pixels. | 
| setHeight(number) | @deprecated. Please use the ‘height’ property instead. Represents the Height of the comment, in unit of pixels. | 
| getWidthInch() | @deprecated. Please use the ‘widthInch’ property instead. Represents the width of the comment, in unit of inches. | 
| setWidthInch(number) | @deprecated. Please use the ‘widthInch’ property instead. Represents the width of the comment, in unit of inches. | 
| getHeightInch() | @deprecated. Please use the ‘heightInch’ property instead. Represents the height of the comment, in unit of inches. | 
| setHeightInch(number) | @deprecated. Please use the ‘heightInch’ property instead. Represents the height of the comment, in unit of inches. | 
| formatCharacters(number, number, Font, StyleFlag) | Format some characters with the font setting. | 
| characters(number, number) | Returns a Characters object 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. | 
| isNull() | Checks whether the implementation object is null. | 
author
Gets and sets Name of the original comment author
author : string;
commentShape
Readonly. Get a Shape object that represents the shape attached to the specified comment.
commentShape : CommentShape;
row
Readonly. Gets the row index of the comment.
row : number;
column
Readonly. Gets the column index of the comment.
column : number;
isThreadedComment
Readonly. Indicates whether this comment is a threaded comment.
isThreadedComment : boolean;
threadedComments
Readonly. Gets the list of threaded comments;
threadedComments : ThreadedCommentCollection;
note
Represents the content of comment.
note : string;
Remarks
If this is a threaded comment, the note could not be changed, otherwise MS Excel could not process it as a threaded comment.
htmlNote
Gets and sets the html string which contains data and some formats in this comment.
htmlNote : string;
Remarks
If this is a threaded comment, the note could not be changed, otherwise MS Excel could not process it as a threaded comment.
font
Readonly. Gets the font of comment.
font : Font;
isVisible
Represents if the comment is visible or not.
isVisible : boolean;
textOrientationType
Gets and sets the text orientation type of the comment.
textOrientationType : TextOrientationType;
textHorizontalAlignment
Gets and sets the text horizontal alignment type of the comment.
textHorizontalAlignment : TextAlignmentType;
textVerticalAlignment
Gets and sets the text vertical alignment type of the comment.
textVerticalAlignment : TextAlignmentType;
autoSize
Indicates if size of comment is adjusted automatically according to its content. Note: In some special cases (such as Mac environment), this setting may not take effect. If this setting does not take effect, please replace it with FitToTextSize().
autoSize : boolean;
heightCM
Represents the height of the comment, in unit of centimeters.
heightCM : number;
widthCM
Represents the width of the comment, in unit of centimeters.
widthCM : number;
width
Represents the width of the comment, in unit of pixels.
width : number;
height
Represents the Height of the comment, in unit of pixels.
height : number;
widthInch
Represents the width of the comment, in unit of inches.
widthInch : number;
heightInch
Represents the height of the comment, in unit of inches.
heightInch : number;
getAuthor()
@deprecated. Please use the ‘author’ property instead. Gets and sets Name of the original comment author
getAuthor() : string;
setAuthor(string)
@deprecated. Please use the ‘author’ property instead. Gets and sets Name of the original comment author
setAuthor(value: string) : void;
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| value | string | The value to set. | 
getCommentShape()
@deprecated. Please use the ‘commentShape’ property instead. Get a Shape object that represents the shape attached to the specified comment.
getCommentShape() : CommentShape;
Returns
getRow()
@deprecated. Please use the ‘row’ property instead. Gets the row index of the comment.
getRow() : number;
getColumn()
@deprecated. Please use the ‘column’ property instead. Gets the column index of the comment.
getColumn() : number;
isThreadedComment()
@deprecated. Please use the ‘isThreadedComment’ property instead. Indicates whether this comment is a threaded comment.
isThreadedComment() : boolean;
getThreadedComments()
@deprecated. Please use the ’threadedComments’ property instead. Gets the list of threaded comments;
getThreadedComments() : ThreadedCommentCollection;
Returns
getNote()
@deprecated. Please use the ’note’ property instead. Represents the content of comment.
getNote() : string;
Remarks
If this is a threaded comment, the note could not be changed, otherwise MS Excel could not process it as a threaded comment.
setNote(string)
@deprecated. Please use the ’note’ property instead. Represents the content of comment.
setNote(value: string) : void;
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| value | string | The value to set. | 
Remarks
If this is a threaded comment, the note could not be changed, otherwise MS Excel could not process it as a threaded comment.
getHtmlNote()
@deprecated. Please use the ‘htmlNote’ property instead. Gets and sets the html string which contains data and some formats in this comment.
getHtmlNote() : string;
Remarks
If this is a threaded comment, the note could not be changed, otherwise MS Excel could not process it as a threaded comment.
setHtmlNote(string)
@deprecated. Please use the ‘htmlNote’ property instead. Gets and sets the html string which contains data and some formats in this comment.
setHtmlNote(value: string) : void;
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| value | string | The value to set. | 
Remarks
If this is a threaded comment, the note could not be changed, otherwise MS Excel could not process it as a threaded comment.
getFont()
@deprecated. Please use the ‘font’ property instead. Gets the font of comment.
getFont() : Font;
Returns
isVisible()
@deprecated. Please use the ‘isVisible’ property instead. Represents if the comment is visible or not.
isVisible() : boolean;
setIsVisible(boolean)
@deprecated. Please use the ‘isVisible’ property instead. Represents if the comment is visible or not.
setIsVisible(value: boolean) : void;
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| value | boolean | The value to set. | 
getTextOrientationType()
@deprecated. Please use the ’textOrientationType’ property instead. Gets and sets the text orientation type of the comment.
getTextOrientationType() : TextOrientationType;
Returns
setTextOrientationType(TextOrientationType)
@deprecated. Please use the ’textOrientationType’ property instead. Gets and sets the text orientation type of the comment.
setTextOrientationType(value: TextOrientationType) : void;
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| value | TextOrientationType | The value to set. | 
getTextHorizontalAlignment()
@deprecated. Please use the ’textHorizontalAlignment’ property instead. Gets and sets the text horizontal alignment type of the comment.
getTextHorizontalAlignment() : TextAlignmentType;
Returns
setTextHorizontalAlignment(TextAlignmentType)
@deprecated. Please use the ’textHorizontalAlignment’ property instead. Gets and sets the text horizontal alignment type of the comment.
setTextHorizontalAlignment(value: TextAlignmentType) : void;
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| value | TextAlignmentType | The value to set. | 
getTextVerticalAlignment()
@deprecated. Please use the ’textVerticalAlignment’ property instead. Gets and sets the text vertical alignment type of the comment.
getTextVerticalAlignment() : TextAlignmentType;
Returns
setTextVerticalAlignment(TextAlignmentType)
@deprecated. Please use the ’textVerticalAlignment’ property instead. Gets and sets the text vertical alignment type of the comment.
setTextVerticalAlignment(value: TextAlignmentType) : void;
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| value | TextAlignmentType | The value to set. | 
getAutoSize()
@deprecated. Please use the ‘autoSize’ property instead. Indicates if size of comment is adjusted automatically according to its content. Note: In some special cases (such as Mac environment), this setting may not take effect. If this setting does not take effect, please replace it with FitToTextSize().
getAutoSize() : boolean;
setAutoSize(boolean)
@deprecated. Please use the ‘autoSize’ property instead. Indicates if size of comment is adjusted automatically according to its content. Note: In some special cases (such as Mac environment), this setting may not take effect. If this setting does not take effect, please replace it with FitToTextSize().
setAutoSize(value: boolean) : void;
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| value | boolean | The value to set. | 
getHeightCM()
@deprecated. Please use the ‘heightCM’ property instead. Represents the height of the comment, in unit of centimeters.
getHeightCM() : number;
setHeightCM(number)
@deprecated. Please use the ‘heightCM’ property instead. Represents the height of the comment, in unit of centimeters.
setHeightCM(value: number) : void;
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| value | number | The value to set. | 
getWidthCM()
@deprecated. Please use the ‘widthCM’ property instead. Represents the width of the comment, in unit of centimeters.
getWidthCM() : number;
setWidthCM(number)
@deprecated. Please use the ‘widthCM’ property instead. Represents the width of the comment, in unit of centimeters.
setWidthCM(value: number) : void;
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| value | number | The value to set. | 
getWidth()
@deprecated. Please use the ‘width’ property instead. Represents the width of the comment, in unit of pixels.
getWidth() : number;
setWidth(number)
@deprecated. Please use the ‘width’ property instead. Represents the width of the comment, in unit of pixels.
setWidth(value: number) : void;
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| value | number | The value to set. | 
getHeight()
@deprecated. Please use the ‘height’ property instead. Represents the Height of the comment, in unit of pixels.
getHeight() : number;
setHeight(number)
@deprecated. Please use the ‘height’ property instead. Represents the Height of the comment, in unit of pixels.
setHeight(value: number) : void;
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| value | number | The value to set. | 
getWidthInch()
@deprecated. Please use the ‘widthInch’ property instead. Represents the width of the comment, in unit of inches.
getWidthInch() : number;
setWidthInch(number)
@deprecated. Please use the ‘widthInch’ property instead. Represents the width of the comment, in unit of inches.
setWidthInch(value: number) : void;
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| value | number | The value to set. | 
getHeightInch()
@deprecated. Please use the ‘heightInch’ property instead. Represents the height of the comment, in unit of inches.
getHeightInch() : number;
setHeightInch(number)
@deprecated. Please use the ‘heightInch’ property instead. Represents the height of the comment, in unit of inches.
setHeightInch(value: number) : void;
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| value | number | The value to set. | 
formatCharacters(number, number, Font, StyleFlag)
Format some characters with the font setting.
formatCharacters(startIndex: number, length: number, font: Font, flag: StyleFlag) : void;
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| startIndex | number | The start index. | 
| length | number | The length. | 
| font | Font | The font setting. | 
| flag | StyleFlag | The flag of the font setting. | 
characters(number, number)
Returns a Characters object that represents a range of characters within the comment text.
characters(startIndex: number, length: number) : FontSetting;
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| startIndex | number | The index of the start of the character. | 
| length | number | The number of characters. | 
Returns
Characters object.
getRichFormattings()
Returns all Characters objects that represents a range of characters within the comment text.
getRichFormattings() : FontSetting[];
Returns
All Characters objects
isNull()
Checks whether the implementation object is null.
isNull() : boolean;