表行是从itext pdf中的新页面开始的 [英] table row is getting started from the new page in itext pdf

查看:242
本文介绍了表行是从itext pdf中的新页面开始的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PdfPTable在pdf中创建一个表。我在表中有一行。在我的行中,最后一列的数据高度超过页面的剩余高度。所以从下一页开始行虽然表格标题位于上一页,但第一页上的标题下方有一个大的空白区域。

I am using PdfPTable to create a table in pdf.I have a single row in the table.In my row last column has data which has height more than remaining height of the page.So row is getting started from the next page while table headers are on the previous page and there is large blank space below the header on the first page.

任何人都可以建议我如何将该行拆分到多个页面上。

Can anybody suggest how can i split the row over multiple page.

谢谢

推荐答案

请阅读书籍或浏览器的http://www.itextpdf.com/book/chapter.php?id=4\">第4章 iText网站上丰富的文档。

Please read chapter 4 of my book or browser the documentation that is abundant on the iText site.

默认情况下,不会拆分表行。 iText将尝试向当前页面添加完整的行,如果该行不适合,它将在下一页上再次尝试。只有当它不适合下一页时,才会拆分该行。这是默认行为,因此您不应对应用程序中看到的内容感到惊讶。

By default, table rows aren't split. iText will try to add a complete row to the current page, and if the row doesn't fit, it will try again on the next page. Only if it doesn't fit on the next page, it will split the row. This is the default behavior, so you shouldn't be surprised by what you see in your application.

您可以更改此默认行为。有一种方法可以让你删除不匹配的内容(这是不是你想要的东西),并且有一种方法可以让你在不适合当前页面时拆分行(这就是你想要的)。

You can change this default behavior. There's a method that will allow you to drop content that doesn't match (this is not what you want) and there's a method that will allow you to split rows when they don't fit the current page (this is what you want).

你需要的方法用于 HeaderFooter2示例

PdfPTable table = getTable(...);
table.setSplitLate(false);

默认情况下,的值setSplitLate() true :iText将尽可能晚地拆分行。通过将此默认值更改为 false ,iText将立即拆分行。

By default, the value of setSplitLate() is true: iText will split rows as late as possible. By changing this default to false, iText will split rows immediately.

这篇关于表行是从itext pdf中的新页面开始的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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