Aspose::Words::Comment::RemoveAllReplies method

Comment::RemoveAllReplies method

Removes all replies to this comment.

void Aspose::Words::Comment::RemoveAllReplies()

Examples

Shows how to remove comment replies.

auto doc = MakeObject<Document>();

auto comment = MakeObject<Comment>(doc, u"John Doe", u"J.D.", System::DateTime::get_Now());
comment->SetText(u"My comment.");

doc->get_FirstSection()->get_Body()->get_FirstParagraph()->AppendChild(comment);

comment->AddReply(u"Joe Bloggs", u"J.B.", System::DateTime::get_Now(), u"New reply");
comment->AddReply(u"Joe Bloggs", u"J.B.", System::DateTime::get_Now(), u"Another reply");

ASSERT_EQ(2, comment->get_Replies()->LINQ_Count());

// Below are two ways of removing replies from a comment.
// 1 -  Use the "RemoveReply" method to remove replies from a comment individually:
comment->RemoveReply(comment->get_Replies()->idx_get(0));

ASSERT_EQ(1, comment->get_Replies()->LINQ_Count());

// 2 -  Use the "RemoveAllReplies" method to remove all replies from a comment at once:
comment->RemoveAllReplies();

ASSERT_EQ(0, comment->get_Replies()->LINQ_Count());

See Also