Comparison is not working with Aspose.Word

Hi,

Comparison is not working with Aspose.Word

Case 1: We have created the sample Asp.Net MVC application With Aspose.Word(.dll [reference] & .lic & Code) and Groupdocs.Comparison then Comparison Result as Null(Not Working). Reference image returns Null Code1.png (312.0 KB)

    public static void CompareDcumentsFromFileToOutputFileWithSettings()
    {
        GroupDocs.Comparison.Common.License.License license = new GroupDocs.Comparison.Common.License.License();
        license.SetLicense("GroupDocs.Comparison.lic");

        string FileDir = System.Web.Hosting.HostingEnvironment.MapPath("/CompareDocs/");
       
        // 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 = GroupDocs.Comparison.Common.ComparisonSettings.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(Path.Combine(FileDir, "1.docx"), Path.Combine(FileDir, "2.docx"), objComparisonSettings);
        result.SaveDocument(Path.Combine(FileDir, "3.docx"));
    }

Case 2: Removed the Aspose.Word(.dll [reference] & .lic & Code) then Groupdocs.Comparison working fine. Reference imageWorking Code without Aspose word.png (111.3 KB)

public static void CompareDcumentsFromFileToOutputFileWithSettings()
    {
        GroupDocs.Comparison.Common.License.License license = new GroupDocs.Comparison.Common.License.License();
        license.SetLicense("GroupDocs.Comparison.lic");

        string FileDir = System.Web.Hosting.HostingEnvironment.MapPath("/CompareDocs/");
       
        // 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 = GroupDocs.Comparison.Common.ComparisonSettings.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;

        Aspose.Words.License wordlic = new Aspose.Words.License();
        wordlic.SetLicense("Aspose.Words.lic");
        string filePath = Path.Combine(FileDir, "1.doc");
        Aspose.Words.Document dooc = new Aspose.Words.Document(filePath);
        
        // Get instance of GroupDocs.Comparison.Comparer and call method Compare.
        GroupDocs.Comparison.Comparer comparison = Common.getComparison();
        ICompareResult result = comparison.Compare(Path.Combine(FileDir, "1.docx"), Path.Combine(FileDir, "2.docx"), objComparisonSettings);
        result.SaveDocument(Path.Combine(FileDir, "3.docx"));
    }

Because of the above issue we are unable to Test the Groupdocs.Comparison in our Existing application

Find the attached Sample Solution Not Working Uploading: clipboard…

Please Provide the solution.

@kranthireddyr,

Can you please attach the project again because we are not able to download it (seems its not attached properly).
You can also upload project to some cloud storage (DropBox or Google Drive) and share link here.
Secondly, mention both APIs (Aspose.Word and GroupDocs.Comparison) versions.

@atirtahir3
GroupDocs.Comparison Version 19.3.1.0,
Aspose.Word Version 16.4.0.0
1.Create ASP.Net MVC Application…Name it as CompareDocs
2.Add GroupDocs.Comparison Version 19.3.1.0,Aspose.Word Version 16.4.0.0
3.Add this two classes in models
4. call this function in HomeController and index actionMethod
CompareDocs.Models.Class1.CompareDcumentsFromFileToOutputFileWithSettings();
5.Verify with two files
6. Check the result in result object and verify

Even if you are not able to reproduce the issue, we will share the application at any cost

@kranthireddyr,

We cannot reproduce this issue at our end. We noticed that if GroupDocs.Comparison for .NET license is not properly applied/loaded in that case we get null results.
Do confirm that license is properly loaded in your application - validate license.png (87.3 KB).
See results here - results.png (92 KB)
Source, target and output files - CompareDocs.zip (9.4 KB)

@atirtahir3

We found the issue with licence as mentioned earlier
GroupDocs.Comparison for .NET license is not properly applied/loaded
Licence Issue.png (83.1 KB)

how to fix this issue.

Find the sample application which is reproducing issue

1 Like

@kranthireddyr,

We explored this application and observed that license is not applied at first place when application is compiled. However, if you debug again (second time), you will see that LicenseChecker will be true.
So, we have logged this issue in our internal issue tracking system with ID : COMPARISONNET-1903.We are now further investigating this scenario. As we have any update, we’ll notify you.

@kranthireddyr,

In order to fix this issue you have to apply license only in Global.asax.cs.

protected void Application_Start()
{
       GroupDocs.Comparison.Common.License.License license = new GroupDocs.Comparison.Common.License.License();
       license.SetLicense(@"D:\GroupDocs.Comparison.lic");
       AreaRegistration.RegisterAllAreas();
       FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
       RouteConfig.RegisterRoutes(RouteTable.Routes);
       BundleConfig.RegisterBundles(BundleTable.Bundles);
}

You must not load/apply license in any other file. Hope this will fix your problem.

1 Like