我正在使用开源 http://itextpdf.com/ , 创建一些 pdf 。
我可以创建一个表格,但所有列的宽度都相同,我需要更改特定列的宽度。
PdfPTable table = new PdfPTable(6);
Phrase tablePhrse = new Phrase("Sl n0", normalFontBold);
PdfPCell c1 = new PdfPCell(tablePhrse);
c1.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(c1);
我找不到任何设置列宽的方法,请提出一些实现此目的的方法..
最佳答案
您可以使用 setWidths() 方法。
table.setWidths(new int[]{200,50});
关于java - 在iText java pdf中设置表格单元格宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14778165/