【发布时间】:2019-05-02 11:50:54
【问题描述】:
我想在 iText 7 中删除表格的整个边框。
在7.0.8 之前,可以向单元格添加字符串 (source):
Cell cell = new Cell();
cell.add("contents go here");
cell.setBorder(Border.NO_BORDER);
table.addCell(cell);
但根据7.1.6,字符串不能再添加到单元格中,只能添加IBlockElement 或Image。
这将是一种解决方法:
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
但如果你有很多细胞,这显然不是首选方式。
那么我现在如何去除表格的边框呢?
简单地做table.setBorder(Border.NO_BORDER)没有效果。
【问题讨论】: