更新时间:2023-12-04 14:02:22
在PdfPTable的构造函数中,指定行中的列数。
In the constructor of PdfPTable you specify the number of columns in a row.
PdfPTable table = new PdfPTable(4) // 4 Columns
PdfPCell cell;
cell = new PdfPCell( new Phrase("Cell with colspan of 4") ) ;
cell. setColspan(4) ; // an entire row
anotherCell = new PdfPCell( new Phrase("Cell with colspan of 4") );
anotherCell.setColspan(4); // a second row
如您所见,当您到达colspan时会创建一个新行当前行。
As you can see, a new row is created when you reach the colspan in the current row.