How can i get paragraphs that already revised?

NodeCollection<Paragraph> paras = document.getChildNodes(NodeType.PARAGRAPH, true);
for (AbstractFormatter formatter : formatters) {
    if (!(formatter instanceof ChapterFormatter)) {
        for (Paragraph paragraph : paras) {
            if (paragraph.getParentNode() instanceof Body && StyleUtils.isNotToc(paragraph)) {
                boolean confirmed = formatter.confirmTitle(paragraph);
                if (formatter.isShouldBreakOnTrue() && confirmed) {
                    break;
                }
            }
        }
    }
}

for (AbstractFormatter formatter : formatters) {
    if (!(formatter instanceof ChapterFormatter)){
        formatter.formatTitle();
    }
}

NodeCollection<Paragraph> devisedParas = document.getChildNodes(NodeType.PARAGRAPH, true);
for(Paragraph paragraph : devisedParas){
    chapterFormatter.confirmTitle(paragraph);
}
chapterFormatter.formatTitle();

in the code above, i first get all the paragraphs using ‘paras’ , then in the ‘formatter.formatTitle()’ , one of the formatter, i used

for (Section section : getSections())
{
    NodeCollection<Node> nodes = section.getBody()
            .getChildNodes(NodeType.ANY, false);
    for (Node node : nodes)
    {
        if (!titles.contains(node))
        {
            node.remove();
        }
    }
}

to remove some paragraphs that I dont want.
however, the second time i used NodeCollection<Paragraph> devisedParas = document.getChildNodes(NodeType.PARAGRAPH, true); seems, the devisedParas is same as paras. how can i get the revised paragraphs ?

@Madecho

To retrieve paragraphs that have been revised in your document, you can utilize the properties of the Paragraph class to check for revisions. In your case, after you have modified the document and removed certain paragraphs, you can filter the paragraphs based on their revision status.

Here’s a code snippet that demonstrates how to get the revised paragraphs:

// Assuming 'document' is your Document object
NodeCollection<Paragraph> allParagraphs = document.GetChildNodes(NodeType.PARAGRAPH, true);
List<Paragraph> revisedParagraphs = new List<Paragraph>();

foreach (Paragraph paragraph in allParagraphs)
{
    // Check if the paragraph has any revision
    if (paragraph.IsInsertRevision || paragraph.IsDeleteRevision || paragraph.IsMoveFromRevision || paragraph.IsMoveToRevision)
    {
        revisedParagraphs.Add(paragraph);
    }
}

// Now 'revisedParagraphs' contains all the paragraphs that have been revised

In this code, we first retrieve all paragraphs in the document. Then, we check each paragraph to see if it has been marked as an insert, delete, move from, or move to revision. If it has, we add it to the revisedParagraphs list.

This approach allows you to effectively filter out the paragraphs that have undergone revisions, even after you have removed some paragraphs from the document.

For more detailed examples and information on working with revisions, you can refer to the documentation on handling revisions in Aspose.Words here.

Sources:
[1]: Working with Revisions.cs