Aspose.Words incorrectly showing the original table and original text of hyperlink even if the target document is the new (revised) document

DocA and DocB were built for testing how Word and Aspose are processing styles, hyperlinks and tables with variations of target document (in Word, “show changes in”) and options selected for Format, Tables and Fields.

With Word 365, when “Show changes in” is set to Revised or New and when Formats, Fields and Tables are NOT selected:

  • Style “body” is from the revised document
  • Text of hyperlink is from the revised document
  • Table structure (column widths) and table content are from the revised document (but no revision mark is applied)

With Aspose.Words, generated from the attached C# in “Code.Txt”, we get:

  • Style “body” is from the revised document (which is OK)
  • Text of hyperlink is from the ORIGINAL document (which is INCORRECT)
  • Table structure (column widths) and table content are from the ORIGINAL document (which is INCORRECT)

When selecting the target as NEW, our understanding is that Aspose.Words should behave as MSWord does with “Show changes in New document” and the text of hyperlinks, the table structure and the table content should be as from the revised document, even if fields and tables are not being compared.

The output of the Aspose compare can be found in:

  • Compare_ByAspose_NoTable_NoFields_TargetNew.xml

The output of the Word compare can be found in:

  • Compare_ByWord365_NoTable_NoFields_ShowChangesInNew.docx

Hyperlinks and Tables from Original when not compared.zip (36.2 KB)

@andrelafond

It appears you are encountering discrepancies between the behavior of Aspose.Words and Microsoft Word when comparing documents, specifically regarding hyperlinks and table structures.

When using Aspose.Words to compare documents, if the text of hyperlinks and the table content is being pulled from the original document instead of the revised document, this may indicate a configuration issue.

To resolve this, ensure you are correctly utilizing the CompareOptions class, particularly the Target property, which should be set to ComparisonTarget.New to reflect the changes in the revised document. Below is a sample code snippet to illustrate the correct usage:

using Aspose.Words;
using Aspose.Words.Comparing;
using System;

class Program
{
    static void Main()
    {
        Document docA = new Document("DocumentA.docx");
        Document docB = new Document("DocumentB.docx");

        CompareOptions options = new CompareOptions
        {
            IgnoreFormatting = true, // Adjust as needed
            IgnoreHeadersAndFooters = true, // Adjust as needed
            IgnoreComments = true, // Adjust as needed
            Granularity = Granularity.CharLevel, // Adjust as needed
            Target = ComparisonTarget.New // Ensure this is set
        };

        docA.Compare(docB, "user", DateTime.Now, options);
        docA.Save("Compared.docx");
    }
}

If the issue persists, consider checking the version of Aspose.Words you are using, as there may be updates or bug fixes related to document comparison that could resolve your issue.

For additional guidance, refer to the official documentation on document comparison, which provides comprehensive information on customizing the comparison behavior.

We are specifically reporting this issue because we did apply the ComparisonTarget.New to the target option, which should correspond the Word option “Show changes in” revised or in new document.

We tested and encountered this issue with Aspose.Words 25.7 and also 25.8.

Note that we also understand that the table and hyperlink would be from the revised document if we opted to include tables and fields in the CompareOptions, but we need sometimes to run compares without comparing the tables and hyperlinks and since we are setting the target to New, the table and hyperlink should be shown as in the revised document, same as MS Word does.

@andrelafond
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-28692

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.