itextにテーブルがあります。
最後の行の特定のセル幅を変更する必要があります。
出来ますか?
編集: colspanは私の問題をカバーしていません。この行には完全に異なる幅が必要です。
最後の行のセル幅を変更する方法はたくさんあります。
A. colspanを使用すると、もちろん、他の行に合わせるためのセルが必要になります。
例 :
PdfPTable table = new PdfPTable(3);
table.addCell("cell A0");
table.addCell("cell A1");
table.addCell("cell A2");
table.addCell("cell B0");
table.addCell("cell B1");
table.addCell("cell B2");
PdfPCell cell = new PdfPCell();
cell.setColspan(2);
cell.addElement(new Phrase("C0 & C1"));
table.addCell(cell);
table.addCell("cell C2");
B.同じ全幅の2つのテーブルで、テーブル間にスペースはありません。
例 :
PdfPTable table = new PdfPTable(1);
PdfPTable table1 = new PdfPTable(3);
table1.setWidthPercentage(100f);
table1.addCell("cell A0");
table1.addCell("cell A1");
table1.addCell("cell A2");
PdfPTable table2 = new PdfPTable(2);
table2.setWidthPercentage(100f);
table2.addCell("cell B0");
table2.addCell("cell B1");
table.addCell(table1);
table.addCell(table2);