Finesse
Finesse

Reputation: 10801

How to freeze a pane in an Excel table using SheetJS?

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.

Upvotes: 8

Views: 4183

Answers (2)

tuliomir
tuliomir

Reputation: 416

It seems there were some tries to implement this feature, but as of version 0.14.1 it is still not available.

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 looks like there were some tries to implement it but there were removed/abandoned, at least on the community version as of 0.14.

Upvotes: 2

Tmh
Tmh

Reputation: 1511

I just researched this, they don't offer freezing option in community edition but in their pro compendium, one of the developers mentioned this in a GitHub issue.

Comment

The reference link is here. https://github.com/SheetJS/sheetjs/issues/785#issuecomment-390501860

Upvotes: 3

Related Questions