GroupDocsGists
10/24/2017 - 5:14 PM

CompareWithAutomaticFormatDetectionFromPathToFileWithExtensionSettingsAndType.cs

//For complete examples and data files, please go to https://github.com/groupdocs-comparison/GroupDocs.Comparison-for-.NET

public static void CompareWithAutomaticFormatDetectionFromPathToFileWithExtensionSettingsAndType()
        {
            // Get instance of GroupDocs.Comparison.Comparison and call method Compare.
            GroupDocs.Comparison.Comparison comparison = Common.getComparison();
            Stream result = comparison.Compare(Path.Combine(Common.sourcePath, Common.sourceFile), Path.Combine(Common.targetPath, Common.targetFile), Path.Combine(Common.resultPath, Common.resultFile), ComparisonType.Words, new WordsComparisonSettings(), FileType.Docx);

            // Get all changes
            GroupDocs.Comparison.Common.Changes.ChangeInfo[] changes = comparison.GetChanges();
            if (changes != null)
            {
                foreach (GroupDocs.Comparison.Common.Changes.ChangeInfo change in changes)
                {
                    Console.WriteLine("Page ID: " + change.Page.Id.ToString() + " Page Height:" + change.Page.Height.ToString() + " Width:" + change.Page.Width.ToString());
                    Console.WriteLine("Change Type: " + change.Type.ToString());
                    Console.WriteLine("Change Text: " + change.Text);
                    // to get style changes
                    //change.StyleChanges
                }
            }

            Console.WriteLine("Press any key to exit");
            Console.ReadKey();

        }