- Product: GroupDocs.Comparison for Java 26.10
- Runtime: Java 21, macOS
- License: metered (evaluation mode gives identical results)
Summary
When a row is deleted from (or inserted into) a worksheet, the comparison pairs each row with the row at the same index in the other workbook instead of matching rows by content. Every row after the deletion is reported as rewritten, and the deleted row is shown as a deleted copy of the last row.
Steps to reproduce
del-old.xlsxhas 6 data rows, R-001 to R-006, on sheetRisks.del-new.xlsxis identical except that row R-003 is removed.- Compare them with default options (
RowDeletionRepro.javain the attachment):
try (Comparer comparer = new Comparer("del-old.xlsx")) {
comparer.add("del-new.xlsx");
comparer.compare("del-result.xlsx", new CompareOptions());
}
Expected
R-003 is marked as a deleted row in place. Rows R-004, R-005 and R-006 are unchanged. getChanges() reports the deleted row, plus the Summary sheet’s risk count changing from 6 to 5.
Actual
getChanges()returns 91 changes.- Rows R-003 to R-005 in the result are redlined word by word into R-004 to R-006. For example, cell A4 shows
R-00+ deleted3+ inserted4. - The original R-006 is appended at the bottom inside a red border as a deleted row.
- So three unchanged rows appear edited, and the removed row is labelled R-006.
| Row | Old file | New file | Shown in result |
|---|---|---|---|
| 4 | R-003 | R-004 | R-003 redlined into R-004 |
| 5 | R-004 | R-005 | R-004 redlined into R-005 |
| 6 | R-005 | R-006 | R-005 redlined into R-006 |
| 7 | R-006 | – | R-006 as a deleted row |
The same happens on real files. On a generated 300-row SBOM workbook where 4 rows were added and 24 changed, getChanges() returns 33,369 changes, 298 of 300 rows are marked (270 of them unchanged), changed rows are compared against the wrong old row, and the comparison takes 3 to 4.5 minutes (two runs). We can’t share that file, but the minimal repro shows the same behaviour.
Also tried
| Option | Changes | Result |
|---|---|---|
new CompareOptions() |
91 | Rows paired by position |
setDetalisationLevel(DetalisationLevel.HIGH) |
89 | Same row pairing |
setSensitivityOfComparisonForTables(100) |
91 | No difference |
Question
Is there an option to match spreadsheet rows by content (an LCS-style alignment of rows), or to pick a key column for matching rows? If not, we would like to request it. Our use case is redlining generated risk tables and traceability matrices between releases, where rows are routinely added and removed.
Lower priority, observed in the same runs
- Unchanged numeric cells come back as text, and formula cells are replaced with fixed values.
StyleSettings.setHighlightColoris not applied to changed cells.
Attachment
groupdocs-xlsx-row-repro.zip: del-old.xlsx, del-new.xlsx, del-result.xlsx, RowDeletionRepro.java, output.txt
groupdocs-xlsx-row-repro.zip (17.3 KB)