Hi,
I have to do an export in excel where autofilter or sort is required. If i add similar as below code in xlsx.js or minified file, it works. But on server, we get the js-xlsx files from bower directly, so I can not use the locally edited files. Would you be willing to edit the files for filtering or sorting ?
In function write_ws_xml(idx, opts, wb) {
...
at line no 7562-->o[o.length]=writextag("autoFilter",null,{ref:ref});
...
}
Can You share example how to add autoFilter for header?
Sure. Edit write_ws_xml(idx, opts, wb) function in xlsx.js or its minified, depending on which one is referred, and add the bold text in between the other code lines.
`if(o.length>sidx+1) { o[o.length] = (''); o[sidx]=o[sidx].replace("/>",">"); }
o[o.length]=writextag('autoFilter',null,{ref:ref});
if(ws['!merges'] !== undefined && ws['!merges'].length > 0) o[o.length] = (write_ws_xml_merges(ws['!merges']));`
Thank You! It's works fine!
I suggest send your changes as pull request.
We're attaching the autofilter range as the ref key of the '!autofilter' key of each worksheet. In future commits we will add more features, but for now basic autofilters can be passed with:
We're pushing a change to add autofilter metadata in the worksheet !autofilter key. For now it just supports a reference, but later we will add more.
worksheet['!autofilter'] = { ref: "A1:C20" };