IronXL How-Tos Add Freeze Panes How to Add Freeze Pane Chaknith Bin Updated:June 22, 2025 Introduction In a large data sheet table, it can be challenging to view the data in 50+ rows or columns beyond the 'Z' column while keeping the corresponding headers in view. The Freeze Pane functionality provides a clever solution to this issue. How to Add Freeze Pane to Spreadsheet To add a freeze pane to your spreadsheet, follow these steps: Install the C# library required for freeze pane Use the CreateFreezePane with 2 parameters to add freeze pane Use the CreateFreezePane with 4 parameters to add freeze pane as well as perform a pre-scrolled action on the spreadsheet Export the spreadsheet to the desired file formats Get started with IronXL Start using IronXL in your project today with a free trial. First Step: Start for Free Add Freeze Pane Example Freeze panes is an option to lock rows and columns in place, allowing them to remain visible while scrolling. It is a very useful feature for keeping the header column or row in place while quickly comparing information. CreateFreezePane(int column, int row) To add a freeze pane, use the CreateFreezePane method, specifying the column and row from which the freeze pane should start. The specified column and row are not included in the freeze pane. For example, workSheet.CreateFreezePane(1, 4) will create a freeze pane starting from column A and rows 1 to 4. The code example below demonstrates how to create a freeze pane starting from column B and row 4: :path=/static-assets/excel/content-code-examples/how-to/add-freeze-panes-add.cs using IronXL; using System.Linq; WorkBook workBook = WorkBook.Load("sample.xlsx"); WorkSheet workSheet = workBook.WorkSheets.First(); // Create freeze pane from column(A-B) and row(1-3) workSheet.CreateFreezePane(2, 3); workBook.SaveAs("createFreezePanes.xlsx"); Imports IronXL Imports System.Linq Private workBook As WorkBook = WorkBook.Load("sample.xlsx") Private workSheet As WorkSheet = workBook.WorkSheets.First() ' Create freeze pane from column(A-B) and row(1-3) workSheet.CreateFreezePane(2, 3) workBook.SaveAs("createFreezePanes.xlsx") $vbLabelText $csharpLabel Demonstration Remove Freeze Pane Use the RemovePane method to quickly remove all existing freeze panes from your spreadsheet. :path=/static-assets/excel/content-code-examples/how-to/add-freeze-panes-remove.cs // Remove all existing freeze or split pane workSheet.RemovePane(); ' Remove all existing freeze or split pane workSheet.RemovePane() $vbLabelText $csharpLabel Advanced Freeze Pane Example The CreateFreezePane method offers an advanced option to create freeze panes with pre-scrolling functionality. CreateFreezePane(int column, int row, int subsequentColumn, int subsequentRow) This method allows you to add a freeze pane based on the specified starting column and row. Additionally, it enables you to apply scrolling to the worksheet. For instance, by using workSheet.CreateFreezePane(5, 2, 6, 7), you can create a freeze pane that spans columns A-E and rows 1-2. It includes a 1-column and 5-row scroll. When the worksheet is first opened, it will display columns A-E, G-... and rows 1-2, 8-... :path=/static-assets/excel/content-code-examples/how-to/add-freeze-panes-advance.cs using IronXL; using System.Linq; WorkBook workBook = WorkBook.Load("sample.xlsx"); WorkSheet workSheet = workBook.WorkSheets.First(); // Overwriting freeze or split pane to column(A-E) and row(1-5) as well as applying prescroll // The column will show E,G,... and the row will show 5,8,... workSheet.CreateFreezePane(5, 5, 6, 7); workBook.SaveAs("createFreezePanes.xlsx"); Imports IronXL Imports System.Linq Private workBook As WorkBook = WorkBook.Load("sample.xlsx") Private workSheet As WorkSheet = workBook.WorkSheets.First() ' Overwriting freeze or split pane to column(A-E) and row(1-5) as well as applying prescroll ' The column will show E,G,... and the row will show 5,8,... workSheet.CreateFreezePane(5, 5, 6, 7) workBook.SaveAs("createFreezePanes.xlsx") $vbLabelText $csharpLabel Demonstration Please noteOnly 1 setting of freeze pane can be applied. Any additional creation of freeze pane will overwrite the previous one. Freeze pane does not work with Microsoft Excel versions 97-2003(.xls). Frequently Asked Questions How do I add a freeze pane to a spreadsheet using C#? To add a freeze pane to a spreadsheet in C#, use the CreateFreezePane method from IronXL. Specify the starting column and row, such as workSheet.CreateFreezePane(1, 4), which locks rows 1 to 4 and column A. What is the purpose of using freeze panes in Excel? Freeze panes are used to lock specific rows or columns in place, allowing them to remain visible while scrolling through other parts of the spreadsheet. This is particularly useful for keeping headers or key data in view when navigating large datasets. How can I remove freeze panes from a spreadsheet programmatically? To remove freeze panes programmatically using IronXL, utilize the RemovePane method, which clears all existing freeze panes from the spreadsheet. Can freeze panes be applied to older Excel file formats? No, freeze panes created using IronXL do not work with Microsoft Excel file formats from versions 97-2003 (.xls). Is it possible to create multiple freeze panes in a single worksheet? No, only one freeze pane can be applied at a time in a worksheet. Any new freeze pane creation will overwrite the previous one. How can I create a freeze pane with pre-scrolling functionality? IronXL allows you to create a freeze pane with pre-scrolling using the CreateFreezePane method with four parameters. For example, workSheet.CreateFreezePane(5, 2, 6, 7) creates a freeze pane starting from columns A-E and rows 1-2, with a scroll that starts from column G and row 8 upon opening the spreadsheet. What file formats can be exported after adding freeze panes? After adding freeze panes using IronXL, you can export your spreadsheet to various file formats, such as XLSX, CSV, and more, using IronXL's export functionalities. How do I install the necessary library to use freeze panes in C#? You need to install the IronXL library from NuGet to use the freeze pane functionality in C#. Visit the NuGet website and search for IronXL.Excel to download and install it. Chaknith Bin Chat with engineering team now Software Engineer Chaknith works on IronXL and IronBarcode. He has deep expertise in C# and .NET, helping improve the software and support customers. His insights from user interactions contribute to better products, documentation, and overall experience. Ready to Get Started? Free NuGet Download Total downloads: 1,558,208 View Licenses