How to Compare Invoices
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.
Invoice | |
---|---|
Source | |
Target |
GroupDocs.Comparison provides the ability to compare two files in DOCX format(or any other supported file formats) with adjustment of detalization level andcomparison sensitivity.
The following are the steps to compare two DOCX files with specific settings of detalization level andcomparison sensitivity.
- Instantiate Comparer objectwith source document path or stream;
- Call add method and specify target document path or stream;
- Instantiate CompareOptions object with desired setSensitivityOfComparison and setDetalisationLevel value;
- Call compare method and pass CompareOptions object to method.
The following code samples demonstrate how to compare two DOCX files.
try (Comparer comparer = new Comparer(SOURCE_FILE)) {
comparer.add(TARGET_FILE);
final CompareOptions compareOptions = new CompareOptions();
compareOptions.setSensitivityOfComparison(100);
compareOptions.setDetalisationLevel(DetalisationLevel.High);
comparer.compare(RESULT_FILE, compareOptions);
}
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 |
---|