Freeze/lock first row in datatables excel export file
Freeze/lock first row in datatables excel export file
sramer123
Posts: 2Questions: 1Answers: 0
Hi, is it possible to freeze/lock first row in datatables excel export file? Any built-in option or custom code?
This discussion has been closed.
Answers
Do you mean you want to create a new row to go at the start of the file? Or do you want a specific row in the table to go to the top?
Colin
I mean exacly the "Freeze Top Row" function from excel (screenshot),
You would need to understand that XML format for the spreadsheet for that, that's beyond what's offered in the standard options.
Colin
I managed to get something similar working and thought I'd share. In our case, we needed to freeze the first 3 columns of the exported table. After reviewing the XML before and after enabling 'Freeze Panes', we used the following excelHtml5 customize function:
There may be a cleaner way to do this - I'm not sure if the <selection> node is needed, but it worked!
Nice, thanks for posting,
Colin