Aspose.Words.Examples.CSharp.Programming_Documents.Comments.ProcessComments.RemoveComments C# (CSharp) Method

RemoveComments() static private method

static private RemoveComments ( Document doc, string authorName ) : void
doc Document
authorName string
return void
        static void RemoveComments(Document doc, string authorName)
        {
            // Collect all comments in the document
            NodeCollection comments = doc.GetChildNodes(NodeType.Comment, true);
            // Look through all comments and remove those written by the authorName author.
            for (int i = comments.Count - 1; i >= 0; i--)
            {
                Comment comment = (Comment)comments[i];
                if (comment.Author == authorName)
                    comment.Remove();
            }
        }
        // ExEnd:RemoveCommentsByAuthor

Same methods

ProcessComments::RemoveComments ( Document doc ) : void