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垂直對齊