Hi
I have been trying to add some styles to the excel file I generate, but the downloaded file does not contain any style. I was following the following documentation: https://www.npmjs.com/package/xlsx-style.
This is my code
function generateReport(data) {
/* generate a worksheet */
var ws = XLSX.utils.aoa_to_sheet(data);
ws['!cols'] = wscols;
for (let key in ws) {
if (key[0] === '!') continue;
ws[key].s = {
border: {
top: { style: "thin", color: { auto: 1} }
}
};
}
/* add to workbook */
var wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, "Report");
/* write workbook (use type 'binary') */
var wbout = XLSX.write(wb, {
bookType: 'xlsx',
type: 'binary'
});
saveAs(new Blob([s2ab(wbout)], {
type: "application/octet-stream"
}), "sheetjs.xlsx");
}
I also have the xlsx.full.min.js file included.
Am I doing something wrong in the code, or is it that I am missing something?
I am having the same issue as well.
var ws = xlsx.utils.sheet_add_json(ws, this.mainData, {skipHeader: false, origin: "A3"});
var cell = ws["A3"];
cell.s = {
font: {
sz: 20
}
}
var wb = xlsx.utils.book_new();
xlsx.utils.book_append_sheet(wb, ws, "Report");
/* write workbook (use type 'binary') */
var wbout = xlsx.write(wb, {bookType:'xlsx', type:'binary'});
FileSaver.saveAs(new Blob([this.s2ab(wbout)],{type:""}), "thebook.xlsx")
//////////////////////////////////////////////////////////////////////////////////////
s2ab(s) {
var buf = new ArrayBuffer(s.length);
var view = new Uint8Array(buf);
for (var i=0; i!=s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
return buf;
}
We offer this in the Pro compendium. Since companies have paid for the features already, it would be unfair to them if we turned around and made it available as open source. We have a longer comment in a gist.
We offer this in the Pro compendium. Since companies have paid for the features already, it would be unfair to them if we turned around and made it available as open source. We have a longer comment in a gist.
You never answer the pro version email...