worksheet1.DisplayOptions.PanesAreFrozen = true;
// Freeze first row in worksheet
worksheet1.DisplayOptions.FrozenPaneSettings.FrozenRows = 1;
// Freeze first 2 columns in worksheet
worksheet1.DisplayOptions.FrozenPaneSettings.FrozenColumns = 2;
// The 4th column is displayed first after the frozen columns
worksheet1.DisplayOptions.FrozenPaneSettings.FirstColumnInRightPane = 4;
// The 3rd row is displayed first after the frozen row
worksheet1.DisplayOptions.FrozenPaneSettings.FirstRowInBottomPane = 2;