我想獲得下面的單元格的高度。如何獲取C#中itextSharp表格單元格的高度?
cell_logo
cell_title
cell_version
cell_dateTime
cell_appVersion
但cell_name.Height回報。我怎樣才能得到這些細胞的實際高度?
PdfPTable table = new PdfPTable(1);
table.TotalWidth = doc.PageSize.Width - doc.LeftMargin - doc.RightMargin;
table.LockedWidth = true;
PdfPCell cell_logo = new PdfPCell(imgLog);
cell_logo.HorizontalAlignment = 1;
cell_logo.BackgroundColor = new BaseColor(System.Drawing.Color.White);
cell_logo.PaddingBottom = 20;
cell_logo.PaddingTop = 50;
PdfPCell cell_title = new PdfPCell(docName);
cell_title.HorizontalAlignment = 1;
cell_title.BackgroundColor = new BaseColor(System.Drawing.Color.White);
cell_title.PaddingBottom = 50;
PdfPCell cell_versions = new PdfPCell(ssVersions);
cell_versions.BackgroundColor = new BaseColor(System.Drawing.Color.White);
cell_versions.PaddingTop = 5;
cell_versions.PaddingBottom = 5;
PdfPCell cell_dateTime = new PdfPCell(time);
cell_dateTime.BackgroundColor = new BaseColor(System.Drawing.Color.White);
cell_dateTime.PaddingTop = 5;
cell_dateTime.PaddingBottom = 5;
PdfPCell cell_appVersion = new PdfPCell(SSCGVersion);
cell_appVersion.BackgroundColor = new BaseColor(System.Drawing.Color.White);
cell_appVersion.MinimumHeight = doc.PageSize.Height - doc.TopMargin - doc.BottomMargin - cell_logo.Height - cell_title.Height - cell_versions.Height - cell_dateTime.Height;
table.AddCell(cell_logo);
table.AddCell(cell_title);
table.AddCell(cell_versions);
table.AddCell(cell_dateTime);
table.AddCell(cell_appVersion);
doc.Add(table);
其實我想設置表格高度等於頁面大小
可能重複[無法正確計算itext PdfPTable/PdfPCell高度](http://stackoverflow.com/questions/24448319/unable-to-calculate-itext-pdfptable-pdfpcell-height-properly)。您需要按照[這些示例](http://developers.itextpdf.com/examples/tables/repeating-rows)中所述的方式詢問表格的高度。高度單元本身並不重要;這是單元格所屬行的高度。另請參閱[如何使頁腳粘到每個pdf頁面的底部?](http://developers.itextpdf.com/question/how-make-footer-stick-bottom-every-pdf-page) –