Compare two Word documents with SuperScript and SubScript content in .NET

Hi Team,

We found issue on SuperScript and SubScript

1.Modified text font style which is having SuperScript and SubScript, but in output document is showing as plan text without previous styles.

Example: SKIP2 (2 as SuperScript ) NAVIGATION3 (3 as SubScript) find in attached document 1st line.

in comparison output document getting SuperScript and SubScript as normal/plan text but it should be as same style.

Please find the attachment with source, Target & output documents Docs.zip (529.9 KB)

Looking for your response.

@kranthireddyr,

As API can detect style changes.
settings.StyleChangeDetection = true;

So, it does mark a style change in output document. Please find the resultant document attached - style changes.zip (15.3 KB).
We’d like to hear your feedback/comments on this. Please let us know if the result is not as expected.

@atirtahir3

In MS Word their is Concept called SuperScript and SubScript styles

We have tested 6 scenarios but all are faild with below code and attachments Super.zip (31.2 KB)

public static void CompareDcumentsFromFileToOutputFileWithSettings()
    {
        // define and set comparison settings and properties.
        ComparisonSettings objComparisonSettings = new ComparisonSettings();
        objComparisonSettings.CalculateComponentCoordinates = true;
        objComparisonSettings.DeletedItemsStyle.StrikeThrough = true;
        objComparisonSettings.DeletedItemsStyle.FontColor = System.Drawing.Color.Red;

        objComparisonSettings.DetailLevel = DetailLevel.Hight;
        objComparisonSettings.DiagramMasterSetting.UseSourceMaster = true;
        objComparisonSettings.GenerateSummaryPage = true;
        objComparisonSettings.InsertedItemsStyle.FontColor = System.Drawing.Color.Green;
        objComparisonSettings.MarkDeletedInsertedContentDeep = true;
        objComparisonSettings.ShowDeletedContent = true;
        objComparisonSettings.StyleChangeDetection = true;
        objComparisonSettings.UseFramesForDelInsElements = true;

        objComparisonSettings.StyleChangedItemsStyle.HighlightColor = System.Drawing.Color.LightGray;
        objComparisonSettings.StyleChangedItemsStyle.FontColor = System.Drawing.Color.Black;

        char[] Mychars = { ' ' };
        objComparisonSettings.WordsSeparatorChars = Mychars;


        // Get instance of GroupDocs.Comparison.Comparer and call method Compare.
        GroupDocs.Comparison.Comparer comparison = Common.getComparison();
        ICompareResult result = comparison.Compare(@"D:\GroupDocsTesting\Docs\old.docx", @"D:\GroupDocsTesting\Docs\new.docx", objComparisonSettings);

        ChangeInfo[] GetChangeInfo = result.GetChanges();

       List<ComparisonChangesCategory> Changes = result.GetChangesCategories(GroupDocs.Comparison.Common.Changes.ComparisonCategoriesType.ByNodeType).ToList();

        //Changes = result.GetChangesCategories(GroupDocs.Comparison.Common.Changes.ComparisonCategoriesType.ByShapes).ToList();

        Changes.AddRange(result.GetChangesCategories(GroupDocs.Comparison.Common.Changes.ComparisonCategoriesType.ByTypeChanged).ToList());

        //Changes = result.GetChangesCategories(GroupDocs.Comparison.Common.Changes.ComparisonCategoriesType.ByZones).ToList();

        Changes.AddRange(result.GetChangesCategories(GroupDocs.Comparison.Common.Changes.ComparisonCategoriesType.ContainsNumbers).ToList());


        Changes.AddRange(result.GetChangesCategories(GroupDocs.Comparison.Common.Changes.ComparisonCategoriesType.OnlyNumbers).ToList());

        // save result document to a file.
        result.SaveDocument(@"D:\GroupDocsTesting\docs\result.docx");
    }

@kranthireddyr,

We investigated the documents you shared. Style change is the only difference between source and target documents and that difference is marked/highlighted in the output. There is nothing new inserted or deleted from either of the documents (source or target).

Can you please tell in which sense document comparison gets failed?
We’ll appreciate your cooperation in this regard.

style(superscript & subscript) got removed, in output document, please verify result.docx

@kranthireddyr,

We are investigating this issue at our end. Your investigation ticket ID is COMPARISONNET-1806. As we have any further update, we’ll notify you.

@kranthireddyr,

We have an update on COMPARISONNET-1806. This issue will be resolved in GroupDocs.Comparison for .NET 19.3.

@kranthireddyr,

Your reported issue COMPARISONNET-1806 is now resolved in version 19.3.1.