[英]Nested iText table does not show borders
我在春季使用iText 2.1.7,并且试图创建PDF文档。 我正在使用嵌套表以实现类似以下内容:
text1 text2
------------------------------------ ----------------------------
| text1 text4 | | text1 |
| text2 text5 | | text2 |
| text3 | | |
| | | |
------------------------------------- ------------------------------
为了做到这一点,我在一个大表内使用2个嵌套表,该大表包含整个段,而嵌套表如上所述。
我的代码:
Table miniTable1 = new Table(2);
Table miniTable2 = new Table(1);
miniTable1.setBorder(Rectangle.BOX);
miniTable1.setBackgroundColor(new Color(0, 255, 0));
miniTable1.setBorderWidth(5);
miniTable2.setBorderWidth(5);
//add text here as cells in the mini tables
Cell cell1 = new Cell(miniTable1);
Cell cell2 = new Cell(miniTable2);
cell2.setHorizontalAlignment("center");
cell1.setColspan(2);
table.addCell(cell1);
cell2.setColspan(1);
table.addCell(cell2);
问题是迷你表的边框未显示。
将边框放在单元格上,例如cell2.setBorderWidth(5f);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.