处理方法:
-
PdfPTable table = new PdfPTable(1);
- table.setSplitLate(false);
- table.setSplitRows(true);
开发中的例子:
document
= new Document();
String
separator =
System.getProperties().getProperty("file.separator");
out
= new FileOutputStream(Const.getSystemExchangePath() + separator +
fileName + ".pdf");
PdfWriter.getInstance(document,
out);
document.open();
table = new
PdfPTable(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);
标题居中处理:
Paragraph
title = new Paragraph(bean.getTitle(), headerFont);
title.setAlignment(Element.ALIGN_CENTER);
cell.addElement(title);
cell.setBorderWidth(0);
table.addCell(cell);
document.add(table);
document.close();
加载中,请稍候......