I want to remove the entire border of a table in iText 7.
Until 7.0.8 it was possible to add strings to cells (source):
Cell cell = new Cell();
cell.add("contents go here");
cell.setBorder(Border.NO_BORDER);
table.addCell(cell);
But as per 7.1.6 strings can't be added to cells anymore, only IBlockElement
or Image
.
This one would be a workaround:
Cell cell;
cell = new Cell().add(new Paragraph("some text"));
cell.setBorder(Border.NO_BORDER);
table.addCell(cell);
cell = new Cell().add(new Paragraph("more text"));
cell.setBorder(Border.NO_BORDER);
table.addCell(cell);
// repeat x times
But it obviously isn't the preferred way if you have many cells.
So how can I remove the border of a table now?
Simply doing table.setBorder(Border.NO_BORDER)
has no effect.