asposecells.api

Class Comment

Encapsulates the object that represents a cell comment.

Example:

workbook = Workbook()
comments = workbook.getWorksheets().get(0).getComments()

# Add comment to cell A1
commentIndex = comments.add(0, 0)
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.")

Property Getters/Setters Summary
methodgetAuthor()
method
setAuthor(value)
           Gets and sets Name of the original comment author
methodgetAutoSize()
method
           Indicates if size of comment is adjusted automatically according to its content.
methodgetColumn()
Gets the column index of the comment.
methodgetCommentShape()
Get a Shape object that represents the shape attached to the specified comment.
methodgetFont()
Gets the font of comment.
methodgetHeight()
method
setHeight(value)
           Represents the Height of the comment, in unit of pixels.
methodgetHeightCM()
method
           Represents the height of the comment, in unit of centimeters.
methodgetHeightInch()
method
           Represents the height of the comment, in unit of inches.
methodgetHtmlNote()
method
           Gets and sets the html string which contains data and some formats in this comment.
methodisThreadedComment()
Indicates whether this comment is a threaded comment.
methodisVisible()
method
setVisible(value)
           Represents if the comment is visible or not.
methodgetNote()
method
setNote(value)
           Represents the content of comment.
methodgetRow()
Gets the row index of the comment.
methodgetTextHorizontalAlignment()
method
           Gets and sets the text horizontal alignment type of the comment. The value of the property is TextAlignmentType integer constant.
methodgetTextOrientationType()
method
           Gets and sets the text orientation type of the comment. The value of the property is TextOrientationType integer constant.
methodgetTextVerticalAlignment()
method
           Gets and sets the text vertical alignment type of the comment. The value of the property is TextAlignmentType integer constant.
methodgetThreadedComments()
Gets the list of threaded comments;
methodgetWidth()
method
setWidth(value)
           Represents the width of the comment, in unit of pixels.
methodgetWidthCM()
method
setWidthCM(value)
           Represents the width of the comment, in unit of centimeters.
methodgetWidthInch()
method
           Represents the width of the comment, in unit of inches.
 
Method Summary
methodcharacters(startIndex, length)
Returns a Characters object that represents a range of characters within the comment text.
methodformatCharacters(startIndex, length, font, flag)
Format some characters with the font setting.
methodgetCharacters()
Returns all Characters objects that represents a range of characters within the comment text.
methodgetRichFormattings()
Returns all Characters objects that represents a range of characters within the comment text.
 

    • Property Getters/Setters Detail

      • getAuthor/setAuthor : String 

        String getAuthor() / setAuthor(value)
        
        Gets and sets Name of the original comment author
      • getCommentShape : CommentShape 

        CommentShape getCommentShape()
        
        Get a Shape object that represents the shape attached to the specified comment.
      • getRow : int 

        int getRow()
        
        Gets the row index of the comment.
      • getColumn : int 

        int getColumn()
        
        Gets the column index of the comment.
      • isThreadedComment : boolean 

        boolean isThreadedComment()
        
        Indicates whether this comment is a threaded comment.
      • getNote/setNote : String 

        String getNote() / setNote(value)
        
        Represents the content of comment. If this is a threaded comment, the note could not be changed, otherwise MS Excel could not process it as a threaded comment.
      • getHtmlNote/setHtmlNote : String 

        String getHtmlNote() / setHtmlNote(value)
        
        Gets and sets the html string which contains data and some formats in this comment. If this is a threaded comment, the note could not be changed, otherwise MS Excel could not process it as a threaded comment.
      • getFont : Font 

        Font getFont()
        
        Gets the font of comment.
      • isVisible/setVisible : boolean 

        boolean isVisible() / setVisible(value)
        
        Represents if the comment is visible or not.
      • getTextOrientationType/setTextOrientationType : int 

        int getTextOrientationType() / setTextOrientationType(value)
        
        Gets and sets the text orientation type of the comment. The value of the property is TextOrientationType integer constant.
      • getTextHorizontalAlignment/setTextHorizontalAlignment : int 

        int getTextHorizontalAlignment() / setTextHorizontalAlignment(value)
        
        Gets and sets the text horizontal alignment type of the comment. The value of the property is TextAlignmentType integer constant.
      • getTextVerticalAlignment/setTextVerticalAlignment : int 

        int getTextVerticalAlignment() / setTextVerticalAlignment(value)
        
        Gets and sets the text vertical alignment type of the comment. The value of the property is TextAlignmentType integer constant.
      • getAutoSize/setAutoSize : boolean 

        boolean getAutoSize() / setAutoSize(value)
        
        Indicates if size of comment is adjusted automatically according to its content.
      • getHeightCM/setHeightCM : float 

        float getHeightCM() / setHeightCM(value)
        
        Represents the height of the comment, in unit of centimeters.
      • getWidthCM/setWidthCM : float 

        float getWidthCM() / setWidthCM(value)
        
        Represents the width of the comment, in unit of centimeters.
      • getWidth/setWidth : int 

        int getWidth() / setWidth(value)
        
        Represents the width of the comment, in unit of pixels.
      • getHeight/setHeight : int 

        int getHeight() / setHeight(value)
        
        Represents the Height of the comment, in unit of pixels.
      • getWidthInch/setWidthInch : float 

        float getWidthInch() / setWidthInch(value)
        
        Represents the width of the comment, in unit of inches.
      • getHeightInch/setHeightInch : float 

        float getHeightInch() / setHeightInch(value)
        
        Represents the height of the comment, in unit of inches.
    • Method Detail

      • formatCharacters

         formatCharacters(startIndex, length, font, flag)
        Format some characters with the font setting.
        Parameters:
        startIndex: int - The start index.
        length: int - The length.
        font: Font - The font setting.
        flag: StyleFlag - The flag of the font setting.
      • characters

        FontSetting characters(startIndex, length)
        Returns a Characters object that represents a range of characters within the comment text.
        Parameters:
        startIndex: int - The index of the start of the character.
        length: int - The number of characters.
        Returns:
        Characters object.
      • getCharacters

        ArrayList getCharacters()
        Returns all Characters objects that represents a range of characters within the comment text. NOTE: This method is now obsolete. Instead, please use Comment.GetRichFormattings() method. This method will be removed 12 months later since November 2023. Aspose apologizes for any inconvenience you may have experienced.
        Returns:
        All Characters objects
      • getRichFormattings

        FontSetting[] getRichFormattings()
        Returns all Characters objects that represents a range of characters within the comment text.
        Returns:
        All Characters objects