Repeat Excel Rows & Columns

When Excel spreadsheets span several pages, the data is easier and quicker to read when we print the column or row titles at the right or top of every page(repeating). These are called Repeating Rows and Columns or Header Rows and Columns in Excel. IronXL can utilize this useful aspect of spreadsheet with just a few lines of code.

SetRepeatingRows(startRow, endRow)

This method is used to set repeating rows. For example, workSheet.SetRepeatingRows(3, 4) will set repeating on row(4-5).

SetRepeatingColumns(startColumn, endColumn)

This method is used to set repeating columns. For example, workSheet.SetRepeatingColumns(0, 2) will set repeating on column(A-C).

These two methods use zero-based indexing as parameters, such that column(0) is "A" and row(1) is 2. Please also note that if these methods are used in combination like the code example above.

The content that span multiple pages along the right side of the first page will have repeating column rule applied only. Figure 1 shows the phenomenon:

Figure 1

Figure 1

Multiple pages span along the bottom side of the first page will contain repeating row.

Lastly, pages that located on the inner side will have both repeating column and row rule applied to it. Figure 2 shows the last two phenomenon:

Figure 2

Figure 2