From the ExcelWorksheet
object, access the View
property. On the returned ExcelWorksheetView
object, call the FreezePanes(row, column)
method, passing in the row and column of the first cell which is not frozen.
For example, to freeze the first row, you would need to pass in 2
to the row parameter:
sheet.View.FreezePanes(2, 1)
https://stackoverflow.com/a/28070406