Back to Devexpress

Use the Excel Export API to Print Titles on a Worksheet

officefileapi-114706-excel-export-library-printing-how-to-print-titles-on-a-worksheet.md

latest1.4 KB
Original Source

Use the Excel Export API to Print Titles on a Worksheet

  • Sep 19, 2023

The example below demonstrates how to print specific rows and columns on every page. To do this, use methods of the XlPrintTitles object accessible from the IXlSheet.PrintTitles property.

  • To repeat specific rows at the top of the printed page, use the XlPrintTitles.SetRows method and pass the zero-based indexes of the first row and the last row to be printed.
  • To repeat specific columns on the left side of the printed page, use the XlPrintTitles.SetColumns method and pass the zero-based indexes of the first column and the last column to be printed.

View Example

csharp
// Print the first column and the first row on every page.
sheet.PrintTitles.SetColumns(0, 0);
sheet.PrintTitles.SetRows(0, 0);
vb
' Print the first column and the first row on every page.
sheet.PrintTitles.SetColumns(0, 0)
sheet.PrintTitles.SetRows(0, 0)