Revision Deletion Compare the change

Hi

We are comparing two docs

We can loop through the Revisions collection

For a Deletion , how can we see what has changed

Doc 1 = Hello World
Doc 2 = Hell World

How we can detect what the deflection was

Thanks

@david.hancock.imagef,

Please see Docs.zip (26.4 KB) and try running the following code:

Document doc1 = new Document(MyDir + @"Doc1.docx");
Document doc2 = new Document(MyDir + @"Doc2.docx");

doc1.Compare(doc2, "Awais", DateTime.Now);

doc1.Save(MyDir + @"Compared-18.1.docx");

Document doc = new Document(MyDir + @"Compared-18.1.docx");

foreach (Revision rev in doc.Revisions)
{
    if (rev.RevisionType != RevisionType.StyleDefinitionChange)
        Console.WriteLine(rev.RevisionType + " | " + rev.ParentNode.ToString(SaveFormat.Text));
}

Thanks

Is there anyway to see the original text in the context of where the deletion occurred e.g.

Document 1 = This is the SAMPLE text before
Document 2 = This is the text before

Get the revision object
We know its a Deletion (RevisionType)
Get the deleted text (assuming rev.ParentNode.ToString(SaveFormat.Text), will return 'SAMPLE

But can we get the node from Document 1 and Document 2 where the deletion was identified
e.g.
for Document 1 = This is the SAMPLE text before
and for Document 2 = This is the text before

@david.hancock.imagef,

Please see Docs.zip (26.7 KB) and try running the following code:

Document doc1 = new Document(MyDir + @"Docs\Doc1.docx");
Document doc2 = new Document(MyDir + @"Docs\Doc2.docx");

doc1.Compare(doc2, "Awais", DateTime.Now);

doc1.Save(MyDir + @"Docs\Compared-18.1.docx");

Document doc = new Document(MyDir + @"Docs\Compared-18.1.docx");

foreach (Revision rev in doc.Revisions)
{
    if (rev.RevisionType != RevisionType.StyleDefinitionChange)
    {
        Console.WriteLine(rev.RevisionType + " | " + rev.ParentNode.ToString(SaveFormat.Text));

        Paragraph revPara = (Paragraph)rev.ParentNode.GetAncestor(NodeType.Paragraph);
        if (revPara != null)
            Console.WriteLine(revPara.ToString(SaveFormat.Text));
    }
}