We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to repeat table headers across all the PDF pages?

Platform: WinForms |
Control: PDF |
Published Date: December 10, 2015 |
Last Revised Date: July 5, 2018
Tags:

To repeat the PdfGrid headers in all the pages of PDF document, we can add the headers using PdfGridHeaderCollection class and enable the RepeatHeader property to repeat header in grid table.

 

Please refer to the following code example on how to repeat the headers into PDF grid table:

C#:

 

//Create a new PDF document.

PdfDocument pdfDocument = new PdfDocument();

PdfPage pdfPage = pdfDocument.Pages.Add();

//Create a new PdfGrid.

PdfGrid pdfGrid = new PdfGrid();

//Add three columns.

pdfGrid.Columns.Add(3);

//Add header.

pdfGrid.Headers.Add(1);

pdfGrid.RepeatHeader = true;

PdfGridRow pdfGridHeader = pdfGrid.Headers[0];

pdfGridHeader.Cells[0].Value = "Employee ID";

pdfGridHeader.Cells[1].Value = "Employee Name";

pdfGridHeader.Cells[2].Value = "Salary";

for (int i = 0; i < 60; i++)

{

//Add rows.

PdfGridRow pdfGridRow = pdfGrid.Rows.Add();

pdfGridRow.Cells[0].Value = "Employe 1 ";

pdfGridRow.Cells[1].Value = "John";

pdfGridRow.Cells[2].Value = "$10,000";

}

//Draw the PdfGrid.

pdfGrid.Draw(pdfPage, PointF.Empty);

//Save the document.

pdfDocument.Save("Output.pdf");

//Close the document

pdfDocument.Close(true);

 

Sample Link:

http://www.syncfusion.com/downloads/support/directtrac/general/ze/PdfGrid1143972

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon