簡體   English   中英

如何使用iTextSharp使表格無破壞

[英]How to make the table non breaking using iTextSharp

我有一張桌子

  PdfPTable tblSummary = new PdfPTable(1);  

它確實有2個嵌套在其中的表。 如何使tblSummary作為一個整體出現( 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的表,所以可以確定表的內容不會超過頁面高度。

任何建議都會有所幫助。

你試過這個:

tblSummary.KeepTogether = true;
PdfPTable tabla = new PdfPTable(2);
float[] anchosTablaTituloDescripcion = new float[] { 4f, 4f };
tabla.SetWidths(anchosTablaTituloDescripcion);
tabla.WidthPercentage = 100;
tabla.KeepTogether = true;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM