PdfPtable只能合并列,不能合并行
public static void main(String[] args) throws Exception {
Document document = new Document();
FileOutputStream writer = new FileOutputStream("e:/2.pdf");
PdfWriter.getInstance(document, writer);
document.open();
//创建有两列的table
PdfPTable table = new PdfPTable(2);
PdfPCell cell=new PdfPCell();
cell.setPhrase(new Phrase("11111"));
cell.setColspan(2);//合并单元格
PdfPCell pCell1 = new PdfPCell();
pCell1.setPhrase(new Phrase("22222"));
PdfPCell pCell2 = new PdfPCell();
pCell2.setPhrase(new Phrase("3333"));
table.addCell(cell);
table.addCell(pCell1);
table.addCell(pCell2);
document.add(table);
document.close();
}