364
Views
9
Comments
[Advanced Excel] Freeze header row functionality
Question
advanced-excel
Service icon
Forge asset by Carlos Freitas

Hello,


I would like to freeze the header row in in a created worksheet,but it seems there is no way to do that using the existing functionality. Anybody with a solution for this?


Thanks!

2022-07-12 16-41-57
Pedro Costa

Hi Danny,


Are you using an excel template or creating a worksheet?

If you are using a template, you can lock the header directly in the template.


Regards

2022-07-12 16-41-57
Pedro Costa

Hi again,


However, I found here in the "What's new" of the versions, the option "Locked" that should work for you. 

You just have to iterate through your header by setting the locked attribute to true.


2025-09-25 22-50-38
Hanno

Hi Pedro

Locked does not lock the cell for scrolling, but for editing.

Hanno

2022-07-12 16-41-57
Pedro Costa

Thanks Hanno,


Is the library used openxml?

If yes, so i think this functionality could be implemented.


https://forums.asp.net/t/2047728.aspx?Freeze+top+row+in+OpenXML

2025-09-25 22-50-38
Hanno

We use the EPPlus c# library. And it can easily be added, yes.

"EPPlus is a .NET library that reads and writes Excel 2007/2010/2013 files using the Open Office Xml format (xlsx). EPPlus supports: Cell Ranges. Cell styling (Border, Color, Fill, Font, Number, Alignments)"
---- https://riptutorial.com/epplus

2022-07-12 16-41-57
Pedro Costa

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

UserImage.jpg
Danny Kok

Thank you both. Im not using a template, but creating a new worksheet indeed. Thats why this functionality could be helpfull to have available within the component.

@Hanno, is this something you are willing to add in the near future?


Danny

2025-09-25 22-50-38
Hanno

Absolutely, just pressed for time right now. Maybe over the weekend...

2017-03-03 12-48-17
Balasubramanian Prakasam

do you have feature freeze header in this component?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.