Java iText表格左边距
如何为表格设置左边距或右边距(不设置单行内容)?我想要类似于Java iText表格左边距,java,itext,Java,Itext,如何为表格设置左边距或右边距(不设置单行内容)?我想要类似于setpacingafter()和setpacingbefore()的东西,但要水平放置。段落有setIndentationRight(),但我找不到类似于表格的内容。如果将表格放入缩进段落中,则可以缩进表格 table = new PdfPTable(2); // Makes the table to get the 100 percent of space that is available horizontally table.
setpacingafter()
和setpacingbefore()
的东西,但要水平放置。段落有setIndentationRight()
,但我找不到类似于表格的内容。如果将表格放入缩进段落中,则可以缩进表格
table = new PdfPTable(2);
// Makes the table to get the 100 percent of space that is available horizontally
table.setWidthPercentage(100);
// Creates a paragraph indentated by the left by 20 units.
p = new Paragraph();
// You insert the table into the indentated paragraph.
p.add(table);
p.setIndentationLeft(20);
// And finally, this will show a table indentated to the left by 20 units.
document.add(p);
将整个表格放在一个带有单个单元格的外部表格中,并在该外部单元格上设置左/右填充?首先在该表格中增加两列,最后按所需大小增加两列,并删除所有边框。就这样。