GroupDocs.Comparison for Java 26.11 Release Notes
Full list of changes in this release
| ID | Summary | Category |
|---|---|---|
| COMPARISONNET-4925, COMPARISONNET-4934 | Images can be compared by the text recognised in them (OCR) instead of by their pixels | Feature |
| COMPARISONJAVA-1798, COMPARISONNET-4940, COMPARISONNET-4945 | Spreadsheet rows are matched by content: an inserted or deleted row no longer marks every following row changed | Fix |
| COMPARISONJAVA-1797, COMPARISONNET-4930 | Spreadsheet comparison takes seconds instead of minutes; faster text diff in every format | Fix |
| COMPARISONJAVA-1796, COMPARISONNET-4946 | XLSX result: rows without a height of their own stay fitted to their content | Fix |
| COMPARISONNET-4947 | XLSX result: unchanged numbers and dates keep their type instead of becoming text | Fix |
| COMPARISONNET-4944 | StyleSettings.setHighlightColor fills the background of changed spreadsheet cells | Fix |
| COMPARISONNET-4927, COMPARISONNET-4928, COMPARISONNET-4923 | Text: words pushed across line breaks are no longer reported deleted and re-inserted | Fix |
| COMPARISONNET-4403, COMPARISONNET-4891 | PDF results laid out from the source page: components at their positions, cells wrap at their own edge | Update |
| COMPARISONNET-4931 | Inline PDF result shows a replaced phrase whole: the old words, then the new ones | Fix |
| COMPARISONNET-4896 | Inline PDF result no longer wraps a line the comparison made slightly longer onto the line below | Fix |
| COMPARISONNET-4763 | PDF result no longer draws a black grid over a table’s own borders | Fix |
| COMPARISONJAVA | PDF pages drawn through forms (spreadsheets saved as PDF) are no longer taken as unchanged | Fix |
| COMPARISONJAVA | PDF: lines of nothing but spaces are no longer reported as changes | Fix |
| COMPARISONJAVA | PDF: a table of contents keeps its page numbers on their lines | Fix |
| COMPARISONNET-4926 | Word: a table column or row that became empty is kept in place instead of deleted and re-inserted | Fix |
| COMPARISONNET-4880 | Presentations: LoadOptions.setSkipExternalResources and setWhitelistedResources now apply | Fix |
| COMPARISONNET-4935 | HTML preview: concurrent previews no longer overwrite each other’s pages; requested pages are honoured | Fix |
| COMPARISONJAVA-1794, COMPARISONJAVA-1795 | Aspose libraries updated | Update |
Behaviour changes to check before upgrading
- The published POM declares a new dependency, Aspose.OCR for Java, used only by OCR comparison. It brings ONNX Runtime with native libraries. If you do not use OCR, you can exclude it; every other comparison works without it.
- Spreadsheet comparison reports different, and usually far fewer, changes when rows were inserted or deleted, because rows are now matched by content.
- PDF results are laid out differently: each component stays where it was on the source page.
- In text and inline PDF results, a replaced word or phrase now reads old first, then new.
- In evaluation mode, only the first 2 pages of a PDF are compared, as in GroupDocs.Comparison for .NET.
Feature — comparing images by recognised text
An image can now be compared by the text that Aspose.OCR reads in it, instead of by its pixels. This suits scans, photos and screenshots of documents, where the same text never has the same pixels.
try (Comparer comparer = new Comparer("source.png")) {
comparer.add("target.png");
OcrOptions ocr = new OcrOptions();
ocr.setEnabled(true);
ocr.setDisplayMode(OcrDisplayMode.SIDE_BY_SIDE); // or TEXT
CompareOptions options = new CompareOptions();
options.setOcr(ocr);
comparer.compare("result.png", options);
for (ChangeInfo change : comparer.getChanges()) {
OcrChangeInfo ocrChange = (OcrChangeInfo) change;
System.out.println(change.getText() + ": confidence " + ocrChange.getConfidence()
+ ", " + ocrChange.getSourceBoxes().length + " box(es) on the source");
}
}
SIDE_BY_SIDE(default) shows the two images side by side with the changed words boxed.TEXTshows only the recognised text, with the changes marked in it.- Each change is an
OcrChangeInfowith the boxes it covers on both images (getSourceBoxes(),getTargetBoxes()) and the recognition confidence (getConfidence()). The boxes are empty inTEXTmode. setLanguage(OcrLanguage)selects the language or script; the default isLATIN. Other languages need a recognition model that is downloaded on first use.setDisableResourceDownloads(true)andsetResourcesPath(String)keep it to models already on disk.
Scope.
- Aspose.OCR for Java must be on the classpath. It is a dependency of the published POM, not part of the jar. Without it an OCR comparison fails with a message that names the missing library. (COMPARISONNET-4925, COMPARISONNET-4934)
Fix — spreadsheet rows matched by content
Rows were paired with the row at the same index in the other workbook. When a row was inserted or deleted, every row after it was reported as rewritten, and the deleted row appeared as a deleted copy of the last row. A workbook of six rows with one of them deleted gave 91 changes; it now gives 8: the six cells of the deleted row, marked in place, and the row count on its summary sheet.
Rows and columns are now aligned by the content of their cells. Rows that are the same in both files are paired directly, and only what lies between them is aligned.
Scope.
- Affects every comparison of spreadsheets in which rows or columns were inserted or deleted. The number of changes reported for such files differs from earlier versions. (COMPARISONJAVA-1798, COMPARISONNET-4940, COMPARISONNET-4945)
Fix — spreadsheet comparison speed
Spreadsheet comparison took minutes even for identical files, and the time grew roughly with the cube of the number of cells: two identical 200 × 20 sheets took 2.5 minutes. They now take under a second (a few seconds for the first comparison after the JVM starts), and a 400 × 20 sheet with one row deleted takes about 7 seconds.
- The word diff behind every comparison finds common runs in time proportional to the product of the two lengths rather than its cube, and returns the same result as before. Word, PDF and text comparison use the same diff and get faster too.
- Word lists and character counts of a text are computed once per comparison instead of once for every text on the other side.
- Identical rows and columns are paired without scoring, so two identical sheets are not aligned at all.
(COMPARISONJAVA-1797, COMPARISONNET-4930)
Fix — spreadsheet result: row heights, number types, highlight colour
- Every row of the result was written with a fixed height, so rows that the source fitted to their content became one line tall and clipped wrapped and large-font cells. Rows without a height of their own are now left to fit their content; rows with an explicit height keep it. (COMPARISONJAVA-1796, COMPARISONNET-4946)
- Unchanged cells were written back as text, so numbers and dates lost their type. They are now written from their value. Formula cells are still written with their calculated values. (COMPARISONNET-4947)
StyleSettings.setHighlightColorhad no effect on spreadsheets. It now fills the background of the changed cells:
StyleSettings deleted = new StyleSettings();
deleted.setHighlightColor(Color.PINK);
CompareOptions options = new CompareOptions();
options.setDeletedItemStyle(deleted);
(COMPARISONNET-4944)
Fix — text comparison across line breaks
An edit that lengthens or shortens a line of a text file pushes words across the line breaks after it. Compared line by line, those words were reported deleted from one line and inserted into the next. Lines are now joined while that gives fewer changes, compared as one run, and laid back out on the target’s lines. A replacement is reported old first, then new, and a run of replaced words shows the old phrase whole, then the new one. The HTML view of a text comparison now applies accepted and rejected changes the same way as the text result.
Scope.
- Comparing one file with several targets still compares line by line. (COMPARISONNET-4927, COMPARISONNET-4928, COMPARISONNET-4923)
Update — PDF result layout
The PDF engine now lays out results as GroupDocs.Comparison for .NET does:
- Every component of the result stands where it was on the source page. Images are placed at their own coordinates, and the page’s vector graphics are carried over.
- A table draws its grid, and the text of each cell wraps at the cell’s own edge, including merged cells.
- Lines are grouped into paragraphs by the distance between baselines, and page margins come from the page itself rather than from where the text ends.
- Pages that are the same in both documents are found anywhere in the document, not only at the start, and are not compared again.
Scope.
- Results look different from earlier versions. Deleted content is drawn where it stood on the source page; where the target has other content in that place, the two can overlap.
- In evaluation mode only the first 2 pages of a PDF are compared, as in .NET. (COMPARISONNET-4403, COMPARISONNET-4891)
Fix — PDF results: smaller fixes
- Replaced phrases. A replacement of several words was drawn one pair at a time, so “Richard McClintock” becoming “Vasily Pupkin” read “Vasily Richard Pupkin McClintock”. The inline result now shows the old phrase, then the new one. (COMPARISONNET-4931)
- Lines made slightly longer. In an inline result, a line that a replacement made one word longer could wrap its last word onto a line of its own, drawn over the next line. The wrap width of a single-line paragraph was taken from a right margin inferred from the longest line, which a ragged right edge makes far too wide. Such a line now keeps its words. (COMPARISONNET-4896)
- Table grids. A table border whose colour could not be detected was painted black, drawing a second grid over the source’s own borders and cutting its last column short. (COMPARISONNET-4763)
- Pages drawn through forms. A page was taken as unchanged when its own content stream was the same in both documents. A page that draws everything through forms, as a spreadsheet saved as PDF does, keeps that stream the same however its forms differ, so its changes were never reported. The forms are now compared too.
- Blank lines. Of a run of lines holding nothing but spaces, every other one was kept and reported as a change of no text. All of them are now dropped.
- Tables of contents. The few characters a change adds to a table of contents line could push its page number onto a line of its own. It now stays on the line.
Fix — Word: emptied table column or row
When a column or row of a table became empty, it was reported as deleted and an empty one as inserted, and the cells after it shifted. It now stays in place, with its content reported as deleted. (COMPARISONNET-4926)
Fix — presentations: external resources
LoadOptions.setSkipExternalResources and setWhitelistedResources, added in 26.10, had no effect on
presentations: linked pictures were still fetched, both when the files were opened and when the result
was saved. They now apply to presentations as to Word and HTML documents, and the result presentation
never fetches external resources. A picture that was not loaded is compared as an empty picture.
(COMPARISONNET-4880)
Fix — HTML preview
The preview pages of an HTML document were rendered to fixed file names in the temp directory. Two previews at once overwrote each other’s pages, a longer document left pages that were handed out as pages of the next one, and the requested page numbers were ignored. Pages are now rendered in memory, only the requested ones are returned, and they are rendered on white instead of a transparent background. (COMPARISONNET-4935)
Update — Aspose libraries
| Library | Before | Now |
|---|---|---|
| Aspose.BarCode | 25.5 | 26.6 |
| Aspose.CAD | 24.6.1 | 26.8 |
| Aspose.Cells | 26.3 | 26.9 |
| Aspose.Diagram | 25.7 | 26.9 |
| Aspose.Email | 26.1 | 26.8 |
| Aspose.PDF | 26.2 | 26.8.1 |
| Aspose.PSD | 25.10 | 26.8 |
| Aspose.Slides | 26.2 | 26.9 |
| Aspose.Words | 26.3 | 26.8 |
The libraries are bundled in the jar as before. Aspose.OCR 26.10.0 is new, as a dependency in the POM (see above). (COMPARISONJAVA-1794, COMPARISONJAVA-1795)