댓글
Contents
[
Hide
]
이 문서에서는 Aspose.Slides for Java를 사용하여 최신 댓글을 추가, 읽기, 삭제 및 답글 작성하는 방법을 보여줍니다.
현대 댓글 추가
사용자가 작성한 댓글을 만들고 프레젠테이션을 저장합니다.
static void addModernComment() {
Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
ICommentAuthor author = presentation.getCommentAuthors().addAuthor("User", "U1");
author.getComments().addModernComment(
"This is a modern comment", slide, null, new Point2D.Float(100, 100), new java.util.Date());
presentation.save("modern_comment.pptx", SaveFormat.Pptx);
} finally {
presentation.dispose();
}
}
현대 댓글 접근
기존 프레젠테이션에서 최신 댓글을 읽어옵니다.
static void accessModernComment() {
Presentation presentation = new Presentation("modern_comment.pptx");
try {
ICommentAuthor author = presentation.getCommentAuthors().get_Item(0);
IModernComment comment = (IModernComment) author.getComments().get_Item(0);
System.out.println("Author: " + author.getName() + ", Comment: " + comment.getText() + ", Position: " + comment.getPosition());
} finally {
presentation.dispose();
}
}
현대 댓글 제거
댓글을 제거하고 업데이트된 파일을 저장합니다.
static void removeModernComment() {
Presentation presentation = new Presentation("modern_comment.pptx");
try {
ICommentAuthor author = presentation.getCommentAuthors().get_Item(0);
IComment comment = author.getComments().get_Item(0);
comment.remove();
presentation.save("modern_comment_removed.pptx", SaveFormat.Pptx);
} finally {
presentation.dispose();
}
}
현대 댓글에 답글 달기
부모 최신 댓글에 답글을 추가합니다.
static void replyToModernComment() {
Presentation presentation = new Presentation();
try {
ISlide slide = presentation.getSlides().get_Item(0);
ICommentAuthor author = presentation.getCommentAuthors().addAuthor("User", "U1");
IModernComment parentComment = author.getComments().addModernComment(
"Parent comment", slide, null, new Point2D.Float(100, 100), new java.util.Date());
IModernComment reply1 = author.getComments().addModernComment(
"Reply 1", slide, null, new Point2D.Float(110, 100), new java.util.Date());
IModernComment reply2 = author.getComments().addModernComment(
"Reply 2", slide, null, new Point2D.Float(120, 100), new java.util.Date());
reply1.setParentComment(parentComment);
reply2.setParentComment(parentComment);
presentation.save("modern_comment_replies.pptx", SaveFormat.Pptx);
} finally {
presentation.dispose();
}
}