コメント
Contents
[
Hide
]
Aspose.Slides for .NET を使用して、モダン コメントの追加、読み取り、削除、および返信を示します。
Add a Modern Comment
ユーザーが作成したコメントを作成し、プレゼンテーションを保存します。
static void Add_Modern_Comment()
{
using var pres = new Presentation();
var slide = pres.Slides[0];
var author = pres.CommentAuthors.AddAuthor("User", "U1");
author.Comments.AddModernComment("This is a modern comment", slide, null, new PointF(100, 100), DateTime.Now);
pres.Save("modern_comment.pptx", SaveFormat.Pptx);
}
Access a Modern Comment
既存のプレゼンテーションからモダン コメントを読み取ります。
static void Access_Modern_Comment()
{
using var pres = new Presentation("modern_comment.pptx");
var author = pres.CommentAuthors[0];
var comment = (IModernComment)author.Comments[0];
Console.WriteLine($"Author: {author.Name}, Comment: {comment.Text}, Position: {comment.Position}");
}
Remove a Modern Comment
コメントを削除し、更新されたファイルを保存します。
static void Remove_Modern_Comment()
{
using var pres = new Presentation("modern_comment.pptx");
var author = pres.CommentAuthors[0];
var comment = author.Comments[0];
comment.Remove();
pres.Save("modern_comment_removed.pptx", SaveFormat.Pptx);
}
Reply to a Modern Comment
親のモダン コメントに返信を追加します。
static void Reply_To_Modern_Comment()
{
using var pres = new Presentation();
var slide = pres.Slides[0];
var author = pres.CommentAuthors.AddAuthor("User", "U1");
var parent = author.Comments.AddModernComment("Parent comment", slide, null, new PointF(100, 100), DateTime.Now);
var reply1 = author.Comments.AddModernComment("Reply 1", slide, null, new PointF(110, 100), DateTime.Now);
var reply2 = author.Comments.AddModernComment("Reply 2", slide, null, new PointF(120, 100), DateTime.Now);
reply1.ParentComment = parent;
reply2.ParentComment = parent;
pres.Save("modern_comment_replies.pptx", SaveFormat.Pptx);
}