Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Freeze panes in Excel using C# and EPPlus

Tags:

c#

epplus

I want to freeze first 5 columns and three rows in excel. I have written the following code for that

Worksheets.View.FreezePanes(5, 5); 

but it freezes columns in first 4 rows also. I want to freeze first 4 columns in excel except in first 4 rows. Is it possible to do?

like image 949
user2148124 Avatar asked Jan 21 '15 06:01

user2148124


People also ask

How do I freeze the first row in Excel in C#?

To freeze the rows or columns you need to call FreezePanes() for the range next to the row or column. For example, if you wish to freeze the first row in Excel sheet, you need to select the range A2. If you select the range B2, then the first row and first column will be frozen in the worksheet.


1 Answers

The first value is for how many rows you want frozen, and the second is for how many columns you want frozen. Therefore, to freeze the first 3 rows and 5 columns you would need to call it as the following:

Worksheets.View.FreezePanes(3, 5); 

You can also take a look at this SO question for more information on FreezePanes.

like image 53
Corey Adler Avatar answered Oct 14 '22 01:10

Corey Adler