GroupDocs.Comparison for .NET 26.10 Release Notes
GroupDocs.Comparison version 26.10 introduces OCR-based image comparison — images are now compared by the text recognized in them rather than by their pixels, with both a Side-by-Side and a plain-text result layout. The release also brings a large set of spreadsheet comparison fixes — including a major performance improvement for XLSX files and correct row alignment, row heights and numeric cell types — along with improvements to PDF, Word, TXT and HTML preview output.
Full list of changes in this release
| Key | Category | Summary |
|---|---|---|
| COMPARISONNET-4844 | Feature | Compare images by recognized text (OCR) |
| COMPARISONNET-4944 | Feature | Support HighlightColor in StyleSettings for spreadsheet comparison |
| COMPARISONNET-4945 | 🔧 Fix | Fix XLSX comparison taking minutes even for identical files |
| COMPARISONNET-4940 | 🔧 Fix | Fix one deleted row marking every following row as changed in XLSX comparison |
| COMPARISONNET-4946 | 🔧 Fix | Preserve auto-height rows instead of forcing a fixed 15 pt height in XLSX result |
| COMPARISONNET-4947 | 🔧 Fix | Preserve the numeric cell type in the spreadsheet comparison result |
| COMPARISONNET-4943 | Enhancement | Avoid replacing short text strings entirely in Excel comparison |
| COMPARISONNET-4931 | Enhancement | Show replaced text as deleted and then inserted in PDF comparison |
| COMPARISONNET-4927 | Enhancement | Normalize the order of deleted and inserted components in TXT comparison output |
| COMPARISONNET-4935 | Enhancement | Remove temporary path usage from HTML preview generation |
| COMPARISONNET-4936 | 🔧 Fix | Fix PageNumbers property being ignored in PreviewOptions when rendering HTML files |
| COMPARISONNET-4926 | 🔧 Fix | Fix document comparison crash when comparing Word documents with tables |
| COMPARISONNET-4923 | 🔧 Fix | Fix lost line breaks in the HTML result of text comparison |
| COMPARISONNET-4917 | Enhancement | A set of internal improvements |
Major Features
Compare images by recognized text (OCR)
GroupDocs.Comparison can now compare images by the text recognized in them instead of by their pixels. Previously, comparing two images meant comparing them pixel by pixel — a scan shifted by a few pixels, re-saved at a different quality or produced by a different scanner reported differences everywhere. With OCR comparison enabled, the text is recognized on both images first and then compared as text, so the result shows the actual wording that changed.
This makes it possible to compare scanned contracts, screenshots, photographed documents and other image-only files in a meaningful way.
New public API
A new OcrOptions class has been added to the GroupDocs.Comparison.Options namespace and is exposed through the new CompareOptions.Ocr property.
| Member | Type | Description |
|---|---|---|
Enabled | bool | true to compare the recognized text; false to compare the images by their pixels. Default is false. |
DisplayMode | OcrDisplayMode | How the comparison result is laid out. Default is OcrDisplayMode.SideBySide. |
Language | OcrLanguage | The language or script the documents are written in. Default is OcrLanguage.Latin. |
DisableResourceDownloads | bool | true to fail when a required recognition model is not available locally; false to download it. Default is false. |
ResourcesPath | string | The folder that contains the recognition models, or null to use the default location. |
The new OcrDisplayMode enum controls how the result of comparing the recognized text is laid out:
| Value | Description |
|---|---|
SideBySide | Default mode. Produces an image showing the source and the target side by side, each marked where it differs from the other, with the original layout of both preserved. |
Text | Produces an image showing the recognized text of both documents as plain text, with deleted and inserted words highlighted. The layout of the original documents — fonts, tables, columns and images — is not reproduced. |
Usage
using (Comparer comparer = new Comparer("source.png"))
{
var options = new CompareOptions
{
Ocr = new OcrOptions
{
Enabled = true,
DisplayMode = OcrDisplayMode.SideBySide
},
GenerateSummaryPage = false
};
comparer.Add("target.png");
var result = comparer.Compare("result.png", options);
}
To get a plain-text result instead of the preserved original layout, set DisplayMode to OcrDisplayMode.Text. To recognize a language other than the Latin script, set Language — and optionally point ResourcesPath at a folder with pre-downloaded models when the machine has no internet access:
using (Comparer comparer = new Comparer("source.png"))
{
var options = new CompareOptions
{
Ocr = new OcrOptions
{
Enabled = true,
DisplayMode = OcrDisplayMode.Text,
Language = OcrLanguage.Cyrillic,
ResourcesPath = @"C:\ocr-models",
DisableResourceDownloads = true
},
GenerateSummaryPage = false
};
comparer.Add("target.png");
comparer.Compare("result.png", options);
}
Support HighlightColor in StyleSettings for spreadsheet comparison
The HighlightColor property of StyleSettings is now applied when comparing spreadsheets, so the background color used to mark changed cells can be customized the same way as for other formats:
using (Comparer comparer = new Comparer("source.xlsx"))
{
comparer.Add("target.xlsx");
var options = new CompareOptions
{
InsertedItemStyle = new StyleSettings { HighlightColor = Color.LightGreen },
DeletedItemStyle = new StyleSettings { HighlightColor = Color.LightPink }
};
comparer.Compare("result.xlsx", options);
}
Improvements
- XLSX comparison takes minutes even for identical files — comparison of large XLSX files was disproportionately slow, taking minutes even when the documents were identical. The bottleneck has been removed and such comparisons now complete quickly. This improvement also affects not identical excel files.