http://blog.sina.com.cn/s/blog_03c54d1001016mhh.html
处理方法:
- PdfPTable table = new PdfPTable(1);
- table.setSplitLate(false);
- table.setSplitRows(true);
开发中的例子:
document= new Document();
Stringseparator =System.getProperties().getProperty("file.separator");
out= new FileOutputStream(Const.getSystemExchangePath() + separator +fileName + ".pdf");
PdfWriter.getInstance(document,out);
document.open();
table = newPdfPTable(4);
table.setWidthPercentage(100);
table.getDefaultCell().setPadding(6);
cell 跨页处理:
table.setSplitLate(false);
table.setSplitRows(true);
PdfPCell cell= new PdfPCell();
cell.setColspan(4);
cell.setUseAscender(true);
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
cell.setVerticalAlignment(Element.ALIGN_TOP);
标题居中处理:
Paragraphtitle = new Paragraph(bean.getTitle(), headerFont);
title.setAlignment(Element.ALIGN_CENTER);
cell.addElement(title);
cell.setBorderWidth(0);
table.addCell(cell);
document.add(table);
document.close();