I am trying to set a fixed column/cell width to my exported excel files with js-xlsx.
我正在尝试用js-xlsx为我导出的excel文件设置一个固定的列/单元格宽度。
EDIT:
编辑:
Here is the source of js-xlsx: https://github.com/SheetJS/js-xlsx
下面是js-xlsx的源代码:https://github.com/SheetJS/js-xlsx
1 个解决方案
#1
39
I found a snippet the the write test here https://github.com/SheetJS/js-xlsx/blob/master/tests/write.js#L14-L19
我在这里找到了一个写测试的片段https://github.com/SheetJS/js-xlsx/blob/master/tests/write.js#L14-L19
For quick reference, where ws is your worksheet.
对于快速引用,ws是您的工作表。
var wscols = [
{wch:6},
{wch:7},
{wch:10},
{wch:20}
];
ws['!cols'] = wscols;
#1
39
I found a snippet the the write test here https://github.com/SheetJS/js-xlsx/blob/master/tests/write.js#L14-L19
我在这里找到了一个写测试的片段https://github.com/SheetJS/js-xlsx/blob/master/tests/write.js#L14-L19
For quick reference, where ws is your worksheet.
对于快速引用,ws是您的工作表。
var wscols = [
{wch:6},
{wch:7},
{wch:10},
{wch:20}
];
ws['!cols'] = wscols;