From 031ab1044c951ce89d95c43c72f1cf1173273716 Mon Sep 17 00:00:00 2001 From: Quang Truong Date: Mon, 27 Apr 2026 16:22:33 +0200 Subject: [PATCH] Fix PDF excel cell style --- .../utils/export/xsl/TransformTableBody.java | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/java/bundles/org.eclipse.set.utils/src/org/eclipse/set/utils/export/xsl/TransformTableBody.java b/java/bundles/org.eclipse.set.utils/src/org/eclipse/set/utils/export/xsl/TransformTableBody.java index e1519f275..3d883fcbd 100644 --- a/java/bundles/org.eclipse.set.utils/src/org/eclipse/set/utils/export/xsl/TransformTableBody.java +++ b/java/bundles/org.eclipse.set.utils/src/org/eclipse/set/utils/export/xsl/TransformTableBody.java @@ -101,24 +101,23 @@ private Set> groupCellByStyle(final Set pageBreakAts) { throw new RuntimeException( "Missing first data row. Is the printing area configured correctly?"); //$NON-NLS-1$ } - for (int i = 0; i <= getHeaderLastColumnIndex(sheet); i++) { - final Cell cellAt = getCellAt(sheet, firstDataRow.getRowNum(), i) - .orElse(firstDataRow.createCell(i)); - - if (parentGroupLastIndex.contains(i) || pageBreakAts.contains(i)) { - setExcelCellBorderStyle(cellAt, BorderDirection.RIGHT, + getFirstDataRow(sheet).forEach(cell -> { + final int index = cell.getColumnIndex() - 1; + if (parentGroupLastIndex.contains(index) + || pageBreakAts.contains(index)) { + setExcelCellBorderStyle(cell, BorderDirection.RIGHT, BorderStyle.MEDIUM); // Set border style for The break column and the after - } else if (pageBreakAts.contains(i - 1)) { - setExcelCellBorderStyle(cellAt, BorderDirection.LEFT, + } else if (pageBreakAts.contains(index - 1)) { + setExcelCellBorderStyle(cell, BorderDirection.LEFT, BorderStyle.MEDIUM); } - if (!isDefaultStyle(cellAt.getCellStyle())) { + if (!isDefaultStyle(cell.getCellStyle())) { Set sameStyleGroup = result.stream() .filter(cells -> cells.stream() - .filter(cell -> isEquals(cellAt.getCellStyle(), - cell.getCellStyle())) + .filter(c -> isEquals(cell.getCellStyle(), + c.getCellStyle())) .findFirst() .orElse(null) != null) .findFirst() @@ -127,9 +126,9 @@ private Set> groupCellByStyle(final Set pageBreakAts) { sameStyleGroup = new LinkedHashSet<>(); result.add(sameStyleGroup); } - sameStyleGroup.add(cellAt); + sameStyleGroup.add(cell); } - } + }); return result; }