This is a migrated thread and some comments may be shown as answers.

Repeat Table Heading after page break

3 Answers 701 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 27 Jul 2015, 05:38 PM
Is there any way to reprint the table's first row (header row) after each page break?  Currently we are using .InsertTable to handle tables that may span multiple pages.

3 Answers, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 28 Jul 2015, 11:30 AM
Hi Dan,

The RadPdfProcessing library doesn't provide such option, but it sounds as a nice idea.

I logged this in our backlog and updated your Telerik points in appreciation of the suggestion. You can track the availability of the functionality in the public portal: Implement Table Repeat Header Row.

Regards,
Petya
Telerik
0
Dan
Top achievements
Rank 1
answered on 20 Mar 2016, 08:18 PM

We are very much looking forward to the addition of this feature in the near future.

And thank you for the workaround code sample.  We have been working through but seem to be stuck - and are hoping perhaps you can suggest a another workaround while we wait for this feature:

The sample code in that link assumes that you are just printing a single table across multiple pages, starting at the top of the first page.  The scenario gets much more complicated when you have content before the table or multiple tables in a report - where a table does not necessarily start at the top of a page.  

The workaround then would seem to be to print the header row along with the data in the initial .InsertTable - then loop through all of the pages after the first and re-insert the header.  Trouble is - how do you set the Top Margin on subsequent pages of an .InsertTable to be greater than the first page?  Seems that we have the cart before the horse here - not sure how to do this .... ?

0
Deyan
Telerik team
answered on 23 Mar 2016, 04:15 PM
Hello Dan,

Thank you for contacting us.

The desired scenario cannot be achieved by using the RadFixedDocumentEditor class as it renders the pdf content sequentially and you cannot set different page margins on different pages. However, RadFixedDocumentEditor internally uses the FixedContentEditor to measure, position and draw the elements. So in order to achieve your custom scenario you may try using FixedContentEditor as well.

I am attaching a demo project demonstrating how to draw a paragraph and then a table with repeating header row. A few words about this project:
  • It is a console application.
  • The demo generates a big paragraph represented by a Block class instance.
  • Using FixedContentEditor the paragraph is drawn and split onto multiple pages.
  • Then again using FixedContentEditor Draw method a long Table is drawn and split onto multiple pages.
  • Another Table is used to draw a repeating header row on each page just before drawing the long table content.
  • Both Block and Table classes implement IBlockElement interface which allows you to Measure, Draw and Split them and get their DesiredSize after the last Draw/Measure method call.  You may find more information about this interface in this forum post and this forum post as well.
  • As a result when you run the demo you may see the exported document with a paragraph split onto pages and a table with repeating header row that begins right after the paragraph.

I hope this is helpful. If you have any other questions or concerns please do not hesitate to contact us again.

Regards,
Deyan
the Telerik team
Tags
PdfProcessing
Asked by
Dan
Top achievements
Rank 1
Answers by
Petya
Telerik team
Dan
Top achievements
Rank 1
Deyan
Telerik team
Share this question
or