I use SheetJS to make an Excel table in my node.js application:
const xlsx = require('xlsx');
const workbook = xlsx.utils.book_new();
const worksheet = xlsx.utils.aoa_to_sheet([
['Number', 'Name', 'Value'],
[1, 'Bill', 1500],
[2, 'John', 2300]
]);
xlsx.utils.book_append_sheet(workbook, worksheet, 'Accounts');
xlsx.writeFile(workbook, 'output.xlsx');
How to freeze a pane of the table, e.g. the first row? Saying "freeze" I mean making a row and/or a column always stay on the top of a table viewer interface.
One of the most common reasons why the Freeze Panes feature is not working is if your Excel file is not in normal file preview mode. Depending on the situation, you can address this problem by setting your preview to Normal or Page Break Preview.
As the result, you'll be able to scroll through the sheet content while continuing to view the frozen cells in the first two rows: Notes: Microsoft Excel allows freezing only rows at the top of the spreadsheet. It is not possible to lock rows in the middle of the sheet.
To freeze horizontal and vertical headings simultaneously: Select the cell in the upper-left corner of the range you want to remain scrollable. Select View tab, Windows Group, click Freeze Panes from the menu bar. Excel inserts two lines to indicate where the frozen panes begin.
On the View tab, select the Freeze Panes command, then choose Freeze Panes from the drop-down menu. The rows will be frozen in place, as indicated by the gray line. You can scroll down the worksheet while continuing to view the frozen rows at the top.
It seems there were some tries to implement this feature, but as of version 0.14.1 it is still not available.
It seems someone in Apr 2, 2017 tried to implement it. I even tried using the sample code on the javascript comments but it didn't work.
Reference: Commit history on GitHub
Doing a code search on v.0.14.1 I found 3 instances of the word "Freeze":
0x0087: 'FREEZE.PANES', // On line 11478
case 'FreezePanes': break; // On line 15746
/* FreezePanes */ // On line 16113
So, it seems there were some tries to implement it but there were removed/abandoned, at least on the community version as of 0.14.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With