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

ExtractComments() static private method

static private ExtractComments ( Document doc, string authorName ) : ArrayList
doc Document
authorName string
return System.Collections.ArrayList
        static ArrayList ExtractComments(Document doc, string authorName)
        {
            ArrayList collectedComments = new ArrayList();
            // Collect all comments in the document
            NodeCollection comments = doc.GetChildNodes(NodeType.Comment, true);
            // Look through all comments and gather information about those written by the authorName author.
            foreach (Comment comment in comments)
            {
                if (comment.Author == authorName)
                    collectedComments.Add(comment.Author + " " + comment.DateTime + " " + comment.ToString(SaveFormat.Text));
            }
            return collectedComments;
        }
        // ExEnd:ExtractCommentsByAuthor

Same methods

ProcessComments::ExtractComments ( Document doc ) : ArrayList