You may please use Worksheet.FreezePanes() function to freeze first row.
// Opening the Excel file through the file stream
Workbook workbook = new Workbook();
// Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[0];
// Applying freeze panes settings
worksheet.FreezePanes(1, 0, 1, 0);
// Saving the modified Excel file
workbook.Save("file.xls");
You can use the Worksheet.GetFreezedPanes() to check if the worksheet contains frozen cells (in rows/cols). GetFreezedPanes method would return a Boolean value whether the specified cell (with the underlying row/column indices, etc.) are locked as frozen panes. See the sample code for your reference:
e.g Sample code:
// Opening the Excel file through the file stream
Workbook workbook = new Workbook();
// Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[0];
// Applying freeze panes settings
worksheet.FreezePanes(1, 0, 1, 0);
int row, col, numrows, numcols;
bool ch = worksheet.GetFreezedPanes( out row, out col, out numrows, out numcols);
Console.WriteLine(row);
Console.WriteLine(col);
Console.WriteLine(numrows);
Console.WriteLine(numcols);
..........
Good to know that your issue is sorted out by the suggested code. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.