How to Compare Invoices
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.
Files | |
---|---|
Source Invoice | ![]() |
GroupDocs.Comparison provides the ability to compare two files in DOCX format (or any other supported file formats with adjustment of detalization level and comparison sensitivity.
The following are the steps to compare two DOCX files with specific settings of detalization level and comparison sensitivity.
- Instantiate Comparer object with source document path or stream;
- Call Add method and specify target document path or stream;
- Instantiate CompareOptions object with desired SensitivityOfComparison and DetalisationLevel value;
- Call Compare method and pass CompareOptions object to method.
The following code samples demonstrate how to compare two DOCX files.
string sourceDocumentPath = @"Invoice_source.docx"; // NOTE: Put here actual path to source document
string targetDocumentPath = @"Invoice_target.docx"; // NOTE: Put here actual path to target document
string outputPath = @"Invoice_result.docx"; // NOTE: Put here actual path to result document
using (Comparer comparer = new Comparer(sourceDocumentPath))
{
comparer.Add(targetDocumentPath);
CompareOptions options = new CompareOptions
{
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:
- GroupDocs.Comparison for .NET examples, plugins, and showcase
- GroupDocs.Comparison for Java examples, plugins, and showcase
- Document Comparison for .NET MVC UI Example
- Document Comparison for .NET App WebForms UI Modern Example
- Document Comparison for Java App Dropwizard UI Modern Example
- Document Comparison for Java Spring UI Example
Free Online App
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.