Sometimes you need to achieve maximum accuracy in comparing files. Suppose you have two versions of an important document and you need to find differences character-by-character or the opposite case, you need to compare the documents, but the details are not important to you, and you only need words that have changes. GroupDocs.Comparison provides the ability to compare documents with sensitivity settings
For example, there are two invoices in the DOCX format and you need to compare their contents with the maximum level of detail and comparison sensitivity.
The following code samples demonstrate how to compare two DOCX files.
stringsourceDocumentPath=@"Invoice_source.docx";// NOTE: Put here actual path to source documentstringtargetDocumentPath=@"Invoice_target.docx";// NOTE: Put here actual path to target documentstringoutputPath=@"Invoice_result.docx";// NOTE: Put here actual path to result documentusing(Comparercomparer=newComparer(sourceDocumentPath)){comparer.Add(targetDocumentPath);CompareOptionsoptions=newCompareOptions{SensitivityOfComparison=100,DetalisationLevel=DetalisationLevel.High};comparer.Compare(outputPath,options);}
As a result, we get a DOCX file where the deleted elements are marked in red, the added – in blue, and the modified – in green
Result Invoice
More resources
Advanced Usage Topics
To learn more about document comparison features, please refer to the advanced usage section.
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples:
Along with full-featured .NET library we provide simple, but powerful free Apps. You are welcome to compare your DOC or DOCX, XLS or XLSX, PPT or PPTX, PDF, EML, EMLX, MSG and other documents with free to use online GroupDocs Comparison App.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.