aspose.cells

Class Comment

Encapsulates the object that represents a cell comment.

Example:

$workbook = new cells\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
functiongetAuthor()
function
setAuthor(value)
           Gets and sets Name of the original comment author
functiongetAutoSize()
function
           Indicates if size of comment is adjusted automatically according to its content.
functiongetColumn()
Gets the column index of the comment.
functiongetCommentShape()
Get a Shape object that represents the shape attached to the specified comment.
functiongetFont()
Gets the font of comment.
functiongetHeight()
function
setHeight(value)
           Represents the Height of the comment, in unit of pixels.
functiongetHeightCM()
function
           Represents the height of the comment, in unit of centimeters.
functiongetHeightInch()
function
           Represents the height of the comment, in unit of inches.
functiongetHtmlNote()
function
           Gets and sets the html string which contains data and some formats in this comment.
functionisThreadedComment()
Indicates whether this comment is a threaded comment.
functionisVisible()
function
setVisible(value)
           Represents if the comment is visible or not.
functiongetNote()
function
setNote(value)
           Represents the content of comment.
functiongetRow()
Gets the row index of the comment.
functiongetTextHorizontalAlignment()
function
           Gets and sets the text horizontal alignment type of the comment. The value of the property is TextAlignmentType integer constant.
functiongetTextOrientationType()
function
           Gets and sets the text orientation type of the comment. The value of the property is TextOrientationType integer constant.
functiongetTextVerticalAlignment()
function
           Gets and sets the text vertical alignment type of the comment. The value of the property is TextAlignmentType integer constant.
functiongetThreadedComments()
Gets the list of threaded comments;
functiongetWidth()
function
setWidth(value)
           Represents the width of the comment, in unit of pixels.
functiongetWidthCM()
function
setWidthCM(value)
           Represents the width of the comment, in unit of centimeters.
functiongetWidthInch()
function
           Represents the width of the comment, in unit of inches.
 
Method Summary
functioncharacters(startIndex, length)
Returns a Characters object that represents a range of characters within the comment text.
functionformatCharacters(startIndex, length, font, flag)
Format some characters with the font setting.
functiongetCharacters()
Returns all Characters objects that represents a range of characters within the comment text.
functiongetRichFormattings()
Returns all Characters objects that represents a range of characters within the comment text.
 

    • Property Getters/Setters Detail

      • getAuthor/setAuthor : String 

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

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

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

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

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

        function getNote() / function 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 

        function getHtmlNote() / function 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 

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

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

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

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

        function getTextVerticalAlignment() / function 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 

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

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

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

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

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

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

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

      • formatCharacters

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

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

        function 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

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