[]
使用此接口可以读取或修改线程式批注内容,在父线程式批注和回复线程式批注之间导航,并处理与顶级线程式批注关联的回复。线程式批注通常通过对单元格调用 IRange.addCommentThreaded(String,String) 创建,也可以从工作表的 ICommentsThreaded 集合访问。
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();
voiddelete()getDate()booleangetText()next()ICommentThreaded 对象。previous()ICommentThreaded 对象。voidsetIsResolved(boolean value) void如果此线程式批注是顶级线程式批注,则将回复添加到此线程式批注的回复集合。如果此线程式批注是回复,则将新回复添加到父线程式批注的回复集合。
此重载使用空作者字符串转发到 addReply(String,String)。
ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Please review the total.", "Alex");
ICommentThreaded reply = comment.addReply("I updated the total.");
String replyText = reply.getText();
text - 回复的内容。不得为 null。如果此值为空或仅包含空白字符,则不会添加回复,并返回 null。text 为空或仅包含空白字符,则返回 null。IllegalStateException - 如果此线程式批注已解决,或此线程式批注是回复且其父线程式批注已解决,导致无法回复。NullPointerException - 如果 text 为 null。如果此线程式批注是顶级线程式批注,则将回复添加到此线程式批注的回复集合。如果此线程式批注本身是回复,则将新回复添加到父线程式批注的回复集合。
ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Review this value", "Alex");
ICommentThreaded reply = comment.addReply("I updated the number.", "Jamie");
String replyText = reply.getText();
text - 回复的内容。不得为 null。如果此值为空或仅包含空白字符,则不会添加回复,并返回 null。author - 回复的作者。text 为空或仅包含空白字符,则返回 null。IllegalStateException - 如果此线程式批注已解决,或此线程式批注是回复且其父线程式批注已解决,导致无法回复。NullPointerException - 如果 text 为 null。如果此线程式批注是回复,则只从父线程式批注的回复列表中删除它自身。
ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Review this value", "Alex");
comment.addReply("I updated the number.", "Jamie");
comment.delete();
ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Please review the total.", "Alex");
comment.setIsResolved(true);
value - 如果线程式批注已解决,则为 true;否则为 false。已解决的线程式批注无法编辑或回复。使用 setIsResolved(boolean) 可以更改解决状态。
ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Please review the total.", "Alex");
comment.setIsResolved(true);
boolean resolved = comment.getIsResolved();
true;否则为 false。返回此线程式批注的文本内容,无论它是顶级线程式批注还是回复。
ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Please review the total.", "Alex");
String text = comment.getText();
null。设置此线程式批注的文本内容,无论它是顶级线程式批注还是回复。
ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Please review the total.", "Alex");
comment.setText("The total has been reviewed.");
text - 线程式批注的文本;可以为 null。返回包含回复此线程式批注的 ICommentThreaded 对象的 ICommentsThreaded 集合。回复按时间戳排序。如果此线程式批注本身是回复,则此方法返回 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);
null。使用返回的 IAuthor 对象可以读取或更新与此线程式批注关联的作者名称。
ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Review this value", "Alex");
IAuthor author = comment.getAuthor();
String name = author.getName();
IAuthor 对象。getLocalDateTime()。此方法已过时。请改用 getLocalDateTime()。
Date 对象。返回线程式批注在本地时区中的 LocalDateTime 值。
ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Review this value", "Alex");
LocalDateTime localDateTime = comment.getLocalDateTime();
LocalDateTime 值。如果线程式批注没有日期和时间值,则返回 null。ICommentThreaded 对象。对于顶级线程式批注,此方法返回工作表上的下一个线程式批注。对于回复线程式批注,此方法返回父线程式批注的回复集合中的下一个回复。
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();
ICommentThreaded 对象。如果顶级线程式批注是工作表上的最后一个线程式批注,或回复线程式批注是线程式批注的回复中的最后一个回复,则返回 null。ICommentThreaded 对象。对于顶级线程式批注,此方法返回工作表上的上一个线程式批注。对于回复线程式批注,此方法返回父线程式批注的回复集合中的上一个回复。
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();
ICommentThreaded 对象。如果顶级线程式批注是工作表上的第一个线程式批注,或回复线程式批注是线程式批注的回复中的第一个回复,则返回 null。顶级线程式批注的父对象为 null。对于回复,此方法返回该回复所属的线程式批注。
ICommentThreaded comment = worksheet.getRange("A1").addCommentThreaded("Review this value", "Alex");
ICommentThreaded reply = comment.addReply("I updated the number.", "Jamie");
ICommentThreaded parent = reply.getParent();
null。
getLocalDateTime()。