Can I replicate the table header when a table keep on in more pages?

蹲街弑〆低调 提交于 2019-12-16 18:03:38

问题


I have the following situation creating a PDF with iTextSharp.

I have some pages that contains some tables. It could be happen that a table begin in a page and keep on in the following page.

I want to know if, when a table keep on in the following page, is it possible to "replicate" the table header in the new page.

For example if a table begin in the page 1 and keep on in the table 2 I want have the following situation:

The table begin with its header in page 1 and keep on in page 2 so at the beginning of page 2 I have again the table header. Something like happen with table in Microsoft Word.

Can I do something like it?

Tnx


回答1:


You are asking for something called "repeating table headers". You can find some examples on the official iText site on the page for the keyword PdfPTable > header rows.

For instance, if you have an instance of PdfPTable named table, and the first two rows you've been adding are actually the header, then you can define them as header rows like this:

table.setHeaderRows(2);

If you want the C# version of the examples taken from my book, you can find them here: http://tinyurl.com/itextsharpIIA2C04

These examples show you that the syntax in C# is slightly different, but still easy:

table.HeaderRows = 1;

In this line, we tell the table that the first row is a header row that should be repeated.



来源:https://stackoverflow.com/questions/24139287/can-i-replicate-the-table-header-when-a-table-keep-on-in-more-pages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!