我使用 PDFTable 和 itext 版本 5.2.1 创建了 pdf 页面我创建了一个定义字体、单元格间距等的方法。这是代码:
Cell textColspanCenter(String staticdata, Font font, int colspan, int rowspan, int border) {
try {
cell = new PdfPCell(new Phrase(staticdata, font));
cell.setColspan(colspan);
cell.setRowspan(rowspan);
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
cell.setBorder(border);
cell.setPadding(4.0f);
if (border == 1) {
cell.setBorder(Rectangle.BOX);
}
return cell;
} catch (Exception e) {
System.out.println("errorin textColspanLeft " + e);
return null;
}
我已将填充设置为 4..但我的客户想要我的一些部分(单元格,用户将在其中写入金额,如果它们彼此太接近,则很难将金额与其来源匹配,因为它没有任何边界)页面之间的空间比其他空间更大(不是整个表格)...所以我尝试更改cell.setPadding
值,但它改变了整个表格的填充。所有元素最终都有更多空间...我尝试更改行跨度值,但它弄乱了我的整个表格...感谢您的帮助...谢谢