Document.Compare does not Mimic MS Word behavior using .NET

Hi,

When comparing two documents I am getting unexpected revisions. The revisions I am getting are in textboxes in either the header or footer. This doesn’t seem to happen with all textboxes in the header or footers. I have saved the comparison document to inspect the revisions and it seems the comparison is deleting some of the textboxes and then inserting another textbox over the top with the same content.

This occurs when I run:

    var options = new Aspose.Words.Comparing.CompareOptions
                {
                    IgnoreComments = true,
                };
    DocToCompare.Compare(Baseline, "example", DateTime.UtcNow, options)

The above code references the documents below.
This only appears to be an issue in v21.5.0 and not in v21.4.0 or older versions.

The file “Comparison output” is the output when I save “DocToCompare” after the comparison is run.

Comparison output.Docx (13.3 KB)

Baseline.docx (12.9 KB)

DocToCompare.docx (22.9 KB)

@dan457

We have logged this problem in our issue tracking system as WORDSNET-22238. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@dan457 We have completed the analysis of the issue. Aspose.Words produced document is almost the same as produced by MS Word. To get result closer to MS Word you need to specify ComparisonTargetType.New option.

CompareOptions co = new CompareOptions() { Target = ComparisonTargetType.New }; docA.Compare(docB, "am", DateTime.Now);

Could you please check on your side and if the result is acceptable for you, we will close this issue as Not a Bug.

Hi, Could you please explain the difference between ComparisonTargetType options and how they will affect the output produced by Compare? I have reviewed the documentation but I cannot find any explanation of what this does or why it would produce a result more similar to MS Word.

@ssmolkin1 ComparisonTargetType.Current places comparison differences in the current document.
ComparisonTargetType.New places comparison differences in a new document like MS Word does by default. But like in MS Word compare settings you can choose target document in Aspose.Words. If you are using Current option it can affect some formatting you have changed in the document.