How to set cell width when export .xlsx files with js-xlsx

后端 未结 6 1338
南笙
南笙 2021-02-01 14:50

I am trying to set a fixed column/cell width to my exported excel files with js-xlsx.

EDIT:

Here is the source of js-xlsx: https://github.com/SheetJS/js-xlsx

6条回答
  •  广开言路
    2021-02-01 15:28

    I found a snippet the the write test here https://github.com/SheetJS/js-xlsx/blob/master/tests/write.js#L14-L19

    For quick reference, where ws is your worksheet.

    var wscols = [
        {wch:6},
        {wch:7},
        {wch:10},
        {wch:20}
    ];
    
    ws['!cols'] = wscols;
    

提交回复
热议问题