[]
An IComment is attached to a worksheet cell and provides access to the comment content, author, anchor cell, visibility, and the underlying shape used to display the comment.
IComment comment = worksheet.getRange("B2").addComment("Review this value.");
String text = comment.getText();
IRange anchorCell = comment.getAnchorCell();
comment.setVisible(true);
voiddelete()voidgetShape()IShape object that represents the shape attached to this comment.getText()booleannext()IComment object that represents the next comment.previous()IComment object that represents the previous comment.voidvoidsetVisible(boolean value) toJson()
worksheet.getRange("D5").setValue("Review");
IComment comment = worksheet.getRange("D5").addComment("Check this value.");
String text = comment.getText();
worksheet.getRange("D5").setValue("Review");
IComment comment = worksheet.getRange("D5").addComment("Check this value.");
comment.setText("Reviewed and approved.");
value - The comment text.Returns the author information associated with the comment.
workbook.setAuthor("Author");
IComment comment = worksheet.getRange("C3").addComment("Review this value.");
String author = comment.getAuthor();
Returns the IRange that the comment is attached to.
worksheet.getRange("D5").setValue("Review");
IComment comment = worksheet.getRange("D5").addComment("Check this value.");
IRange cell = comment.getAnchorCell();
IRange object to which this comment is attached.Use this method to remove a single cell comment. To remove comments from multiple cells in a range, use IRange.clearComments().
worksheet.getRange("D5").setValue("Review");
IComment comment = worksheet.getRange("D5").addComment("Check this value.");
comment.delete();
IComment object that represents the next comment.Returns null if the current comment is the last comment on the worksheet.
worksheet.getRange("C3").addComment("First note.");
IComment comment = worksheet.getRange("D5").addComment("Second note.");
worksheet.getRange("F7").addComment("Third note.");
IComment nextComment = comment.next();
null if the current comment is the last comment on the worksheet.IComment object that represents the previous comment.Returns null if the current comment is the first comment on the worksheet.
worksheet.getRange("B2").addComment("First note.");
IComment comment = worksheet.getRange("D5").addComment("Second note.");
IComment previousComment = comment.previous();
null if the current comment is the first comment on the worksheet.Use this method to check whether the comment is visible.
IComment comment = worksheet.getRange("C3").addComment("Review this value.");
comment.setVisible(true);
boolean visible = comment.getVisible();
true if the comment is visible; otherwise, false.Use this method to show or hide the comment.
IComment comment = worksheet.getRange("C3").addComment("Review this value.");
comment.setVisible(true);
value - true if the comment is visible; otherwise, false.IShape object that represents the shape attached to this comment. Use the returned shape to configure the comment's layout, such as its size, line, fill, and text formatting.
worksheet.getRange("D5").setValue("Review");
IComment comment = worksheet.getRange("D5").addComment("Check this value.");
IShape shape = comment.getShape();
shape.setWidth(220);
IShape object attached to the comment.Use this method to apply serialized comment information to the current comment. The JSON content is typically generated by toJson().
IComment sourceComment = worksheet.getRange("A1").addComment("Review this value.");
sourceComment.getShape().setWidth(220);
String json = sourceComment.toJson();
IComment targetComment = worksheet.getRange("C3").addComment("Draft");
targetComment.fromJson(json);
json - The JSON string that contains comment information.The returned string contains the comment information and can be used with fromJson(String) to recreate or update a comment.
worksheet.getRange("D5").setValue("Review");
IComment comment = worksheet.getRange("D5").addComment("Check this value.");
String json = comment.toJson();