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.
Unfortunately, activation email could not send to your email. Please try again.

How to repeat table headers across all the PDF pages?

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

Article ID: Published Date: Last Revised Date: Platform: Control:
5836 12/10/2015 07/05/2018 Windows Forms PDF
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.