natergj / excel4node

Node module to allow for easy Excel file creation
MIT License
1.38k stars 215 forks source link

Cannot freeze columns #316

Open abhidp opened 4 years ago

abhidp commented 4 years ago

Describe the bug When trying to freeze a column, it totally hides that column from the sheet and is not accessible in any way.

To Reproduce

const xl = require('excel4node');
const wb = new xl.Workbook();
const ws = wb.addWorksheet('ColumnFreeze');

ws.cell(1, 1).string('First column should be frozen');
ws.cell(2, 1).string('First column should be frozen');
ws.cell(3, 1).string('First column should be frozen');
ws.cell(4, 1).string('First column should be frozen');
ws.cell(5, 1).string('First column should be frozen');
ws.cell(6, 1).string('First column should be frozen');
ws.cell(7, 1).string('First column should be frozen');
ws.cell(8, 1).string('First column should be frozen');
ws.cell(9, 1).string('First column should be frozen');
ws.cell(10, 1).string('First column should be frozen');

ws.column(1).freeze();
wb.write('FirstColumnFrozen.xlsx');

Expected behavior ws.column(1).freeze() should freeze the first column and rest of the columns should be scrollable

Environment (please complete the following information):

Additional context Add any other context about the problem here. Log entries related to the issue are good things.

kongpcc02 commented 4 years ago

Column 1 was freeze but width of the column is 0.00. Please set style of column 1. ws.column(1).setWidth(Math.max('First column should be frozen'.length));