1
我面臨Itext的問題,在兩頁之間切割一行。我的代碼像這樣工作:Itext:拆分行問題
PdfPTable Master = new PdfPTable(1);
Master.setHeaderRows(1);
PdfPTable Header = new PdfPTable(1);//create header table
//fill header
PdfPCell HeaderCell = new PdfPCell();
HeaderCell.addElement(Header);
Master.addCell(HeaderCell);//add header in master
foreach result in query
{
float[] colsWidth = { 4f, 9f, 5f, 8f };
PdfPTable Content = new PdfPTable(colsWidth);//create content table
//fill content
content.keepRowsTogether(0);
PdfPCell ContentCell = new PdfPCell();
ContentCell.addElement(Content);
Master.addCell(ContentCell);//add header in master
}
document.add(Master);
但是在PDF文檔中,一些內容表在兩個頁面(以及一些主錶行)之間分開。 我嘗試添加:
Master.keepRowsTogether(0);
Master.setSplitLate(false);
沒有效果。
我也試過:
Master.setSplitRows(false);
但這使切排完全消失。 有人知道如何禁用主表中的行拆分?
我試過,但不幸的是書面這不起作用細胞,所以我嘗試了不同的方式,並通過添加'Master.keepRowsTogether(0)'工作,所以謝謝你FevPlr。 – Kromen
歡迎kromen。 –