9

我有一张桌子

  PdfPTable tblSummary = new PdfPTable(1);  

它确实有 2 个嵌套在其中的表。tblSummary如果它不适合当前页面,我怎样才能使显示为一个整体(行不能中断到另一个页面)或整个表格转移到另一个页面。

我已经尝试SplitLateSplitRows

我的代码是这样的

PdfPTable tblSummary = new PdfPTable(1);
PdfPCell csummarycell = new PdfPCell();  
PdfPTable tblSummaryFirst = new PdfPTable(3);
.
.
csummarycell.AddElement(tblSummaryFirst);
.
.
tblSummary.AddCell(csummarycell);
tblSummary.SplitLate = true;
tblSummary.SplitRows = false;

像这样,我向 tblSummary 添加了一个表,而结果表的高度总是小于 pagesize 的高度,因此可以确定表的内容不会超过页面高度。

任何建议都会很有帮助。

4

2 回答 2

25

你有没有试过这个:

tblSummary.KeepTogether = true;
于 2011-11-17T09:39:22.320 回答
1
PdfPTable tabla = new PdfPTable(2);
float[] anchosTablaTituloDescripcion = new float[] { 4f, 4f };
tabla.SetWidths(anchosTablaTituloDescripcion);
tabla.WidthPercentage = 100;
tabla.KeepTogether = true;
于 2014-05-28T14:50:06.807 回答