Articles in this section
Category / Section

How to repeat table headers across all the WinForms PDF pages?

1 min read

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);

 

Conclusion

I hope you enjoyed learning about how to repeat table headers across all the WinForms PDF pages.

You can refer to our WinForms PDF feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms PDF example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments
Please sign in to leave a comment
Access denied
Access denied