PdfTable:最后一个单元格是不可见 [英] PdfTable: last cell is not visible

查看:469
本文介绍了PdfTable:最后一个单元格是不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用PdfPTable以下列方式

I use PdfPTable in the following way

var myTable = new PdfPTable( 3 );

foreach(var nextString in myStrings)
{

var nextCell = new PdfPCell( new Phrase( nextString, smallFont ) );
nextCell.Border = Rectangle.NO_BORDER;
nextCell.AddCell(nextCell);
}

pdfDocument.Add(myTable);



全部是完美然后总细胞计数乘以列数(3)。
但是,当我想创建一个表3列,但4细胞 - ?最后一行是不可见的。

All is perfect then total cell count multiply the number of columns (3). But when I wanted to create a table with 3 columns but 4 cells - last row is not visible.

如何解决这样的问题。

iTextSharp的5.3.3.0

itextsharp 5.3.3.0

推荐答案

为了解决这个问题,其他人我推荐使用在 PdfPTable 方法 CompleteRow()

To solve this issue and others I recommend the use of the PdfPTable method CompleteRow().

这将确保所有未完成的行纷纷加入到让他们完全让他们在生成的PDF显示额外的电池。

This will ensure that any incomplete rows have extra cells added to make them complete so that they show up in the generated PDF.

一般情况下,一个不完整的行会是一个逻辑错误然而,通过使用 CompleteRow()您可以轻松地找出您所做的这些错误,并纠正他们。

Generally, an incomplete row will be a logic error however by using CompleteRow() you can easily identify where you have made these errors, and correct them.

在条款您的例子:

var myTable = new PdfPTable( 3 );

foreach(var nextString in myStrings)
{
    var nextCell = new PdfPCell( new Phrase( nextString, smallFont ) );
    nextCell.Border = Rectangle.NO_BORDER;
    nextCell.AddCell(nextCell);
}

myTable.CompleteRow();

pdfDocument.Add(myTable);

这篇关于PdfTable:最后一个单元格是不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆