gitbrent / xlsx-js-style

SheetJS Community Edition + Basic Cell Styles
https://gitbrent.github.io/xlsx-js-style/
Apache License 2.0
349 stars 56 forks source link

Auto width #12

Open vencho-mdp opened 1 year ago

vencho-mdp commented 1 year ago

Hi! Firstly, thanks for this library!

One cool feature that could be added is the ability to adjust the cell width to the text. I'd be willing to do it if you could explain a little bit about where I could start.

khoa-nv commented 1 year ago

You can set the col width like this

var wscols = [
    {wch:6},
    {wch:7},
    {wch:10},
    {wch:20}
];

ws['!cols'] = wscols;