3
A
回答
8
搜索的很多天以后。我的解决办法是缠上了我的表外表1个细胞。将单元格设置为页面高度减去两个边距并将垂直对齐设置为底部。将您想要的所有内容添加到此表中。
全例如,为了简洁省略错误代码
public void run() {
try {
Document document = new Document(PageSize.LETTER, 10.0f, 10.0f, 36.0f, 36.0f);
PdfWriter pdfWriter = PdfWriter.getInstance(document, new FileOutputStream("test.pdf"));
document.open();
PdfPTable outerTable = new PdfPTable(1);
outerTable.setWidthPercentage(100.0f);
PdfPCell cell = new PdfPCell();
cell.setMinimumHeight(document.getPageSize().getHeight() - 36.0f - 36.0f);
cell.setVerticalAlignment(Element.ALIGN_BOTTOM);
cell.addElement(createTable());
outerTable.addCell(cell);
document.add(outerTable);
document.newPage();
document.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public PdfPTable leftTable() {
PdfPTable table = new PdfPTable(1);
for (int i = 0; i < 50; i++) {
table.addCell("Cell: " + i);
}
return table;
}
public PdfPTable middleTable() {
PdfPTable table = new PdfPTable(1);
for (int i = 0; i < 10; i++) {
table.addCell("Cell: " + i);
}
return table;
}
public PdfPTable rightTable() {
PdfPTable table = new PdfPTable(1);
for (int i = 0; i < 100; i++) {
table.addCell("Cell: " + i);
}
return table;
}
public PdfPTable createTable() {
PdfPTable table = new PdfPTable(3);
table.getDefaultCell().setVerticalAlignment(Element.ALIGN_BOTTOM);
table.addCell(leftTable());
table.addCell(middleTable());
table.addCell(rightTable());
return table;
}
相关问题
- 1. 垂直对齐SlickGrid头垂直文本
- 2. 使用垂直对齐css垂直对齐文本
- 3. 如何垂直对齐文本? (垂直对齐不工作)
- 4. 垂直对齐
- 5. 垂直对齐
- 6. 垂直对齐
- 7. 垂直对齐
- 8. 垂直对齐
- 9. 垂直对齐
- 10. 垂直对齐
- 11. 垂直对齐
- 12. 垂直对齐
- 13. 垂直对齐的文字
- 14. 垂直对齐文本
- 15. CSS:垂直对齐文本?
- 16. 垂直对齐文本div
- 17. 垂直对齐文本
- 18. 垂直对齐CSS文本
- 19. CSS - 垂直对齐文本
- 20. CSS垂直文本对齐
- 21. div文本垂直对齐
- 22. UITextView文本垂直对齐
- 23. 垂直对齐文本
- 24. 垂直文本对齐
- 25. 垂直对齐UILabel
- 26. NSMutableAttributedString垂直对齐
- 27. Css垂直对齐
- 28. CSS垂直对齐
- 29. NSComboBox垂直对齐
- 30. HTML垂直对齐