[]
        
(Showing Draft Content)

ICommentThreaded

Interface ICommentThreaded


public interface ICommentThreaded
Represents a cell's threaded comment. This object can represent both a top-level threaded comment or its replies.

Use this interface to read or modify threaded comment content, navigate between parent and reply threaded comments, and work with the replies associated with a top-level threaded comment. A threaded comment is typically created from a cell by calling IRange.addCommentThreaded(String,String) and can also be accessed from the worksheet's ICommentsThreaded collection.


 ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Review this value", "Alex");
 ICommentThreaded reply = comment.addReply("I updated the number.", "Jamie");
 ICommentThreaded parent = reply.getParent();
 ICommentsThreaded replies = comment.getReplies();
 
  • Method Details

    • addReply

      ICommentThreaded addReply(String text)
      Adds a reply to this threaded comment.

      Adds a reply to this threaded comment's replies collection if the threaded comment is a top-level threaded comment. If this threaded comment is a reply, it adds the new reply to the parent threaded comment's replies collection.

      This overload forwards to addReply(String,String) with an empty author string.

      
       ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Please review the total.", "Alex");
       ICommentThreaded reply = comment.addReply("I updated the total.");
       String replyText = reply.getText();
       
      Parameters:
      text - The content of the reply. Must not be null. If this value is empty or contains only whitespace, no reply is added and null is returned.
      Returns:
      The newly added reply. Returns null if text is empty or contains only whitespace.
      Throws:
      IllegalStateException - if this threaded comment cannot be replied to because it is resolved, or because it is a reply whose parent threaded comment is resolved.
      NullPointerException - if text is null.
    • addReply

      ICommentThreaded addReply(String text, String author)
      Adds a reply to this threaded comment.

      Adds the reply to this threaded comment's replies collection if this threaded comment is a top-level threaded comment. If this threaded comment is itself a reply, the new reply is added to the parent threaded comment's replies collection.

      
       ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Review this value", "Alex");
       ICommentThreaded reply = comment.addReply("I updated the number.", "Jamie");
       String replyText = reply.getText();
       
      Parameters:
      text - The content of the reply. Must not be null. If this value is empty or contains only whitespace, no reply is added and null is returned.
      author - The author of the reply.
      Returns:
      The newly added reply. Returns null if text is empty or contains only whitespace.
      Throws:
      IllegalStateException - if this threaded comment cannot be replied to because it is resolved, or because it is a reply whose parent threaded comment is resolved.
      NullPointerException - if text is null.
    • delete

      void delete()
      Deletes the specified threaded comment and all replies associated with that threaded comment.

      If this threaded comment is a reply, it deletes only itself from the parent threaded comment's reply list.

      
       ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Review this value", "Alex");
       comment.addReply("I updated the number.", "Jamie");
       comment.delete();
       
    • setIsResolved

      void setIsResolved(boolean value)
      Sets a value indicating whether the threaded comment is resolved.
      
       ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Please review the total.", "Alex");
       comment.setIsResolved(true);
       
      Parameters:
      value - true if the threaded comment is resolved; otherwise, false.
    • getIsResolved

      boolean getIsResolved()
      Gets a value indicating whether the threaded comment is resolved.

      A resolved threaded comment cannot be edited or replied to. Use setIsResolved(boolean) to change the resolved status.

      
       ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Please review the total.", "Alex");
       comment.setIsResolved(true);
       boolean resolved = comment.getIsResolved();
       
      Returns:
      true if the threaded comment is resolved; otherwise, false.
    • getText

      String getText()
      Gets the threaded comment's text.

      Returns the text content of this threaded comment, whether it is a top-level threaded comment or a reply.

      
       ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Please review the total.", "Alex");
       String text = comment.getText();
       
      Returns:
      The text of the threaded comment, or null if no text is set.
    • setText

      void setText(String text)
      Sets the threaded comment's text.

      Sets the text content of this threaded comment, whether it is a top-level threaded comment or a reply.

      
       ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Please review the total.", "Alex");
       comment.setText("The total has been reviewed.");
       
      Parameters:
      text - The text of the threaded comment; can be null.
    • getReplies

      ICommentsThreaded getReplies()
      Gets the replies of this threaded comment.

      Returns a ICommentsThreaded collection that contains the ICommentThreaded objects replying to this threaded comment. The replies are sorted by time stamp. If this threaded comment is itself a reply, this method returns null.

      
       ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Please review the total.", "Alex");
       comment.addReply("I updated the total.", "Jamie");
       comment.addReply("I verified the formula.", "Morgan");
       ICommentsThreaded replies = comment.getReplies();
       ICommentThreaded firstReply = replies.get(0);
       
      Returns:
      A collection of replies for this threaded comment, sorted by time stamp. Returns null if this threaded comment is a reply.
    • getAuthor

      IAuthor getAuthor()
      Gets the author object of the threaded comment.

      Use the returned IAuthor object to read or update the author name associated with this threaded comment.

      
       ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Review this value", "Alex");
       IAuthor author = comment.getAuthor();
       String name = author.getName();
       
      Returns:
      The IAuthor object associated with the threaded comment.
    • getDate

      @Deprecated Date getDate()
      Deprecated.
      Use getLocalDateTime() instead.
      Gets the date and time when the threaded comment was added in local time.

      This method is obsolete. Use getLocalDateTime() instead.

      Returns:
      A Date object that represents the date and time when the threaded comment was added in local time.
    • getLocalDateTime

      LocalDateTime getLocalDateTime()
      Gets the date and time when the threaded comment was added in local time.

      Returns a LocalDateTime value for the threaded comment in the local time zone.

      
       ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Review this value", "Alex");
       LocalDateTime localDateTime = comment.getLocalDateTime();
       
      Returns:
      A LocalDateTime value that represents the date and time when the threaded comment was added in local time. Returns null if the threaded comment does not have a date and time value.
    • next

      Returns the ICommentThreaded object that represents the next threaded comment.

      For a top-level threaded comment, this method returns the next threaded comment on the worksheet. For a reply threaded comment, this method returns the next reply in the parent threaded comment's replies collection.

      
       ICommentThreaded first = worksheet.getRange("A1").addCommentThreaded("Please review the total.", "Alex");
       worksheet.getRange("A2").addCommentThreaded("Check the discount.", "Jamie");
       ICommentThreaded nextComment = first.next();
       String nextText = nextComment.getText();
       
      Returns:
      The next ICommentThreaded object. Returns null if the top-level threaded comment is the last threaded comment on a sheet, or if the reply threaded comment is the last reply of a threaded comment's replies.
    • previous

      ICommentThreaded previous()
      Returns the ICommentThreaded object that represents the previous threaded comment.

      For a top-level threaded comment, this method returns the previous threaded comment on the worksheet. For a reply threaded comment, this method returns the previous reply in the parent threaded comment's replies collection.

      
       worksheet.getRange("A1").addCommentThreaded("Please review the total.", "Alex");
       ICommentThreaded comment = worksheet.getRange("A2").addCommentThreaded("Check the discount.", "Jamie");
       ICommentThreaded previousComment = comment.previous();
       String previousText = previousComment.getText();
       
      Returns:
      The previous ICommentThreaded object. Returns null if the top-level threaded comment is the first threaded comment on a sheet, or if the reply threaded comment is the first reply of a threaded comment's replies.
    • getParent

      ICommentThreaded getParent()
      Gets the parent object for the specified threaded comment.

      The top-level threaded comment's parent is null. For a reply, this method returns the threaded comment that the reply belongs to.

      
       ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Review this value", "Alex");
       ICommentThreaded reply = comment.addReply("I updated the number.", "Jamie");
       ICommentThreaded parent = reply.getParent();
       
      Returns:
      The parent threaded comment. Returns null if this is a top-level threaded comment.