Skip to main content

Use the Excel Export API to Print Titles on a Worksheet

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

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