We are using Aspose.Cells for Java 26.6 to convert Excel workbooks to PDF via Workbook.save(path, PdfSaveOptions) . When a worksheet contains cells styled with CellBorderType.DOUBLE on the top and bottom borders and the cell text uses a small font size (e.g. 10pt), the double-line border in the produced PDF visibly clips the top and bottom of the text in every row. In Microsoft Excel the same workbook prints/exports to PDF with the double-line border sitting cleanly outside the text.
The row height Aspose picks for the PDF output does not appear to reserve space for the second line of the double-line border, so the inner stroke of the border and the top/bottom of the glyphs occupy the same vertical pixels.
Environment
- Aspose.Cells for Java: 26.6
- Aspose.Total license: yes (also reproduced under evaluation)
- JDK: OpenJDK 21 (Zulu 21.0.2)
- OS: macOS 15 / Linux (both reproduce)
Reproduction
- Open the attached
reproducer.xlsxin Microsoft Excel and print / export to PDF from Excel. The double-line borders sit outside the text; no overlap. - Convert the same
reproducer.xlsxto PDF using the code below. - Open the produced PDF (
output-baseline.pdf, also attached, rendered asoutput-baseline.pngfor reference). In every row the top and bottom double-line borders visibly clip the top and bottom of the cell text — “Requirement”, “Description”, “Owner”, “Status”, and every data row are affected.
Code used to reproduce
Workbook wb = new Workbook("reproducer.xlsx");
PdfSaveOptions options = new PdfSaveOptions();
options.setCompliance(PdfCompliance.PDF_17);
options.setOnePagePerSheet(false);
options.setAllColumnsInOnePagePerSheet(false);
options.setPrintingPageType(PrintingPageType.IGNORE_BLANK);
options.setOptimizationType(PdfOptimizationType.STANDARD);
options.setFontSubstitutionCharGranularity(true);
options.setCheckFontCompatibility(true);
wb.save("output.pdf", options);
The reproducer workbook itself is built with a minimal style — 10pt Calibri, CellBorderType.DOUBLE on all four sides of every populated cell, Color.BLACK , no other formatting. Source used to generate reproducer.xlsx:
Workbook workbook = new Workbook();
Worksheet sheet = workbook.getWorksheets().get(0);
Cells cells = sheet.getCells();
Style style = workbook.createStyle();
style.getFont().setSize(10);
style.getFont().setName("Calibri");
style.setBorder(BorderType.LEFT_BORDER, CellBorderType.DOUBLE, Color.getBlack());
style.setBorder(BorderType.RIGHT_BORDER, CellBorderType.DOUBLE, Color.getBlack());
style.setBorder(BorderType.TOP_BORDER, CellBorderType.DOUBLE, Color.getBlack());
style.setBorder(BorderType.BOTTOM_BORDER, CellBorderType.DOUBLE, Color.getBlack());
String[] header = { "Requirement", "Description", "Owner", "Status" };
for (int row = 0; row < 6; row++) {
for (int col = 0; col < 4; col++) {
String text = row == 0
? header[col]
: "Row " + row + " Col " + col + " with narrow text";
cells.get(row, col).putValue(text);
cells.get(row, col).setStyle(style);
}
}
workbook.save("reproducer.xlsx");
Expected behavior
Double-line borders in the produced PDF are drawn outside the cell’s text area, matching what Microsoft Excel produces when printing/exporting the same file to PDF.
Actual behavior
The top and bottom double-line borders visibly clip the top and bottom of the cell text in every row of the produced PDF.
Workarounds attempted (none resolve the issue)
- Calling
Worksheet.autoFitRows()beforeWorkbook.save(...)— row heights change marginally but the top/bottom double-line borders still overlap the glyphs. Attached asoutput-autofit-rows.pdf/output-autofit-rows.pngfor reference. - Calling
Worksheet.autoFitRows()+Worksheet.autoFitColumns()— column widths grow enough to fit the horizontal text but the vertical border-vs-glyph overlap is unchanged.
Notes
- This was surfaced by a real customer file (Excel worksheet with 10pt text and Excel’s “double” border preset applied via the Format Cells → Border dialog). The reproducer above is a fully synthetic, public-safe minimal example that produces the same symptom.
- Please confirm any fix targets Aspose.Cells for Java, not only .NET.
Thank you.
original csv
image.png (3.7 KB)
output pdf
image.png (3.8 KB)
another output pdf image
image.png (37.4 KB)