The problem with a background colour painting

I’ve written the code:

I’m trying to paint the background colour of every parent node of a revision with “RevisionType.Insertion”.
I’m attaching 3 files: 1.docx and 2.docx are the ones that being compared, 3.docx is the output (for the Compare method).
Also there is a problem with numeration. Although the 2nd thing is present in both documents, it has a revision.

“resultFilePath” generate a new doc in main method.



Thanks for your inquiry. Please call the Shading.ClearFormatting method as shown below in your code. We have compared the documents using Document.Compare method and have not found the shared issue. Please check the attached output document. (9.6 KB)

if (rev.ParentNode is Run)
    log += Environment.NewLine + "found Run:";
    log += Environment.NewLine + rev.ParentNode.GetText();
    Run r = rev.ParentNode as Run;
    r.Font.Shading.BackgroundPatternColor = System.Drawing.Color.Beige;

In case you are using older version of Aspose.Words, we suggest you please use latest version of Aspose.Words for .NET 18.1.