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.getWorksheets().get(0).getComments();

//Add comment to cell A1
var commentIndex = comments.add(0, 0);
var comment = comments.get(commentIndex);
comment.setNote("First note.");
comment.getFont().setName("Times New Roman");

//Add comment to cell B2
comments.add("B2");
comment = comments.get("B2");
comment.setNote("Second note.");

Methods

MethodDescription
getAuthor()Gets and sets Name of the original comment author
setAuthor(string)Gets and sets Name of the original comment author
getCommentShape()Get a Shape object that represents the shape attached to the specified comment.
getRow()Gets the row index of the comment.
getColumn()Gets the column index of the comment.
isThreadedComment()Indicates whether this comment is a threaded comment.
getThreadedComments()Gets the list of threaded comments;
getNote()Represents the content of comment.
setNote(string)Represents the content of comment.
getHtmlNote()Gets and sets the html string which contains data and some formats in this comment.
setHtmlNote(string)Gets and sets the html string which contains data and some formats in this comment.
getFont()Gets the font of comment.
isVisible()Represents if the comment is visible or not.
setIsVisible(boolean)Represents if the comment is visible or not.
getTextOrientationType()Gets and sets the text orientation type of the comment.
setTextOrientationType(TextOrientationType)Gets and sets the text orientation type of the comment.
getTextHorizontalAlignment()Gets and sets the text horizontal alignment type of the comment.
setTextHorizontalAlignment(TextAlignmentType)Gets and sets the text horizontal alignment type of the comment.
getTextVerticalAlignment()Gets and sets the text vertical alignment type of the comment.
setTextVerticalAlignment(TextAlignmentType)Gets and sets the text vertical alignment type of the comment.
getAutoSize()Indicates if size of comment is adjusted automatically according to its content.
setAutoSize(boolean)Indicates if size of comment is adjusted automatically according to its content.
getHeightCM()Represents the height of the comment, in unit of centimeters.
setHeightCM(number)Represents the height of the comment, in unit of centimeters.
getWidthCM()Represents the width of the comment, in unit of centimeters.
setWidthCM(number)Represents the width of the comment, in unit of centimeters.
getWidth()Represents the width of the comment, in unit of pixels.
setWidth(number)Represents the width of the comment, in unit of pixels.
getHeight()Represents the Height of the comment, in unit of pixels.
setHeight(number)Represents the Height of the comment, in unit of pixels.
getWidthInch()Represents the width of the comment, in unit of inches.
setWidthInch(number)Represents the width of the comment, in unit of inches.
getHeightInch()Represents the height of the comment, in unit of inches.
setHeightInch(number)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.

getAuthor()

Gets and sets Name of the original comment author

getAuthor() : string;

setAuthor(string)

Gets and sets Name of the original comment author

setAuthor(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

getCommentShape()

Get a Shape object that represents the shape attached to the specified comment.

getCommentShape() : CommentShape;

Returns

CommentShape

getRow()

Gets the row index of the comment.

getRow() : number;

getColumn()

Gets the column index of the comment.

getColumn() : number;

isThreadedComment()

Indicates whether this comment is a threaded comment.

isThreadedComment() : boolean;

getThreadedComments()

Gets the list of threaded comments;

getThreadedComments() : ThreadedCommentCollection;

Returns

ThreadedCommentCollection

getNote()

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)

Represents the content of comment.

setNote(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe 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()

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)

Gets and sets the html string which contains data and some formats in this comment.

setHtmlNote(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe 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()

Gets the font of comment.

getFont() : Font;

Returns

Font

isVisible()

Represents if the comment is visible or not.

isVisible() : boolean;

setIsVisible(boolean)

Represents if the comment is visible or not.

setIsVisible(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getTextOrientationType()

Gets and sets the text orientation type of the comment.

getTextOrientationType() : TextOrientationType;

Returns

TextOrientationType

setTextOrientationType(TextOrientationType)

Gets and sets the text orientation type of the comment.

setTextOrientationType(value: TextOrientationType) : void;

Parameters:

ParameterTypeDescription
valueTextOrientationTypeThe value to set.

getTextHorizontalAlignment()

Gets and sets the text horizontal alignment type of the comment.

getTextHorizontalAlignment() : TextAlignmentType;

Returns

TextAlignmentType

setTextHorizontalAlignment(TextAlignmentType)

Gets and sets the text horizontal alignment type of the comment.

setTextHorizontalAlignment(value: TextAlignmentType) : void;

Parameters:

ParameterTypeDescription
valueTextAlignmentTypeThe value to set.

getTextVerticalAlignment()

Gets and sets the text vertical alignment type of the comment.

getTextVerticalAlignment() : TextAlignmentType;

Returns

TextAlignmentType

setTextVerticalAlignment(TextAlignmentType)

Gets and sets the text vertical alignment type of the comment.

setTextVerticalAlignment(value: TextAlignmentType) : void;

Parameters:

ParameterTypeDescription
valueTextAlignmentTypeThe value to set.

getAutoSize()

Indicates if size of comment is adjusted automatically according to its content.

getAutoSize() : boolean;

setAutoSize(boolean)

Indicates if size of comment is adjusted automatically according to its content.

setAutoSize(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getHeightCM()

Represents the height of the comment, in unit of centimeters.

getHeightCM() : number;

setHeightCM(number)

Represents the height of the comment, in unit of centimeters.

setHeightCM(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

getWidthCM()

Represents the width of the comment, in unit of centimeters.

getWidthCM() : number;

setWidthCM(number)

Represents the width of the comment, in unit of centimeters.

setWidthCM(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

getWidth()

Represents the width of the comment, in unit of pixels.

getWidth() : number;

setWidth(number)

Represents the width of the comment, in unit of pixels.

setWidth(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

getHeight()

Represents the Height of the comment, in unit of pixels.

getHeight() : number;

setHeight(number)

Represents the Height of the comment, in unit of pixels.

setHeight(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

getWidthInch()

Represents the width of the comment, in unit of inches.

getWidthInch() : number;

setWidthInch(number)

Represents the width of the comment, in unit of inches.

setWidthInch(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

getHeightInch()

Represents the height of the comment, in unit of inches.

getHeightInch() : number;

setHeightInch(number)

Represents the height of the comment, in unit of inches.

setHeightInch(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe 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:

ParameterTypeDescription
startIndexnumberThe start index.
lengthnumberThe length.
fontFontThe font setting.
flagStyleFlagThe 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:

ParameterTypeDescription
startIndexnumberThe index of the start of the character.
lengthnumberThe 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;