SpreadJS Documentation
GC.Spread.Sheets.Comments Namespace / CommentManager type / add Method
The row index of the cell.
The column index of the cell.
The text of the comment.
In This Topic
    add Method
    In This Topic
    Adds a comment to the cell for the indicated row and column.
    Syntax
    var instance = new GC.Spread.Sheets.Comments.CommentManager(sheet);
    var value; // Type: Comment
    value = instance.add(row, col, text);
    function add( 
       row : number,
       col : number,
       text : string
    ) : Comment;

    Parameters

    row
    The row index of the cell.
    col
    The column index of the cell.
    text
    The text of the comment.

    Return Value

    The comment that has been added to the cell.
    Example
    This example adds a comment to a cell.
    var comment = activeSheet.comments.add(5, 5, "Comment1");
    comment.backColor("yellow");
    comment.foreColor("green");
    comment.displayMode(GC.Spread.Sheets.Comments.DisplayMode.hoverShown);
    
    var comment1 = activeSheet.comments.add(1, 1, "");
    comment1.text("Comment2");
    comment1.displayMode(GC.Spread.Sheets.Comments.DisplayMode.alwaysShown);
    comment1.backColor("red");
    comment1.foreColor("blue");
    
    var gcomments = activeSheet.comments.all();
    for (var i = 0; i < gcomments.length; i++) {
         alert(gcomments[i].text());
    }
    See Also