I am creating a PDF file with iText in Java. Columns in the table have a fixed width and text that is too long for one row is wrapped in a cell. But the transfer is not used. The word "Leistungsscheinziffer" is shown as: Leistungssc // Break here heinziffer
My code where I use hyphenation is:
final PdfPTable table = new PdfPTable(sumCols);
table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
table.getDefaultCell().setPadding(4f);
table.setWidths(widthsCols);
table.setWidthPercentage(100);
table.setSpacingBefore(0);
table.setSpacingAfter(5);
final Phrase result = new Phrase(text, font);
result.setHyphenation(new HyphenationAuto("de", "DE", 2,2));
final PdfPCell cell = new PdfPCell(table.getDefaultCell());
cell.setPhrase(result);
table.addCell(cell);
...
Hyphene is activated, and the following test results: Lei-stungs-schein-zif-fer "
Hyphenator h = new Hyphenator("de", "DE", 2, 2);
Hyphenation s = h.hyphenate("Leistungsscheinziffer");
System.out.println(s);
Is there anything I forgot to set to the table in which the hyphen works? Thank you for your help. If you need more information about my code, I will tell you.
source
share