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!
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
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.
Hi Pedro
Locked does not lock the cell for scrolling, but for editing.
Hanno
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
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
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.
ExcelWorksheet
View
ExcelWorksheetView
FreezePanes(row, column)
For example, to freeze the first row, you would need to pass in 2 to the row parameter:
2
sheet.View.FreezePanes(2, 1)
https://stackoverflow.com/a/28070406
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
Absolutely, just pressed for time right now. Maybe over the weekend...
do you have feature freeze header in this component?