[SOLVED] making bold cells, align text to the right
Hey guys, thank you for amazing work you are doing.
From what I see bold cell is most requested feature and I needed ability to align text to the right, so made a quick and dirty patch — https://gist.github.com/smalljam/b0e8b7a7e5a218b58e62#file-xlsx-patch
there is also test.js example with data structure, where you can use bold: true and 'alignRight: true'
Maybe someone will find this usable.
Thanks.
Anton.
So how to apply this patch to existing js-xlsx?
I'm not sure it's still relevant for up-to-date version of js-xlsx, I've used "custom" version with patch from above applied by hands :)
I'm not sure it's still relevant for up-to-date version of js-xlsx, I've used "custom" version with patch from above applied by hands :)
I think it's relevant. Bolding and aligning are still not available in main branch.
please let me know if you will be able to apply it to current version, good luck!
@smalljam ur solution works for me.. thanks a tonn 👍
@pankajnagarsekar How you appled patch let me know please??
@krishnakanth94 I replaced the code in min.js. that's it
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.
hi @smalljam ,
may i get help in applyin it to my application? i need to set the cell values for the specific column but my code looks like this;
let excelCols = rowData;
/* cell width */
var wscols = [];
let cell;
for (let i = 0; i < excelCols.length; i++) {
wscols.push({ wch: 20 }); // wch = character
}
/* convert state to workbook */
const ws = XLSX.utils.aoa_to_sheet(xlsData);
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, "SheetJS");
ws['!cols'] = wscols;
/* generate XLSX file */
const wbout = XLSX.write(wb, { type: "array", bookType: "xlsx" });
/* send to client */
let fileName = "Report" + moment().format('YYYYMMDDhhmmss') + ".xlsx";
saveAs(new Blob([wbout], { type: "application/octet-stream" }), fileName);
and i need to set these columns under (header 9-15) bold

hi @smalljam ,
may i get help in applyin it to my application? i need to set the cell values for the specific column but my code looks like this;
let excelCols = rowData; /* cell width */ var wscols = []; let cell; for (let i = 0; i < excelCols.length; i++) { wscols.push({ wch: 20 }); // wch = character } /* convert state to workbook */ const ws = XLSX.utils.aoa_to_sheet(xlsData); const wb = XLSX.utils.book_new(); XLSX.utils.book_append_sheet(wb, ws, "SheetJS"); ws['!cols'] = wscols; /* generate XLSX file */ const wbout = XLSX.write(wb, { type: "array", bookType: "xlsx" }); /* send to client */ let fileName = "Report" + moment().format('YYYYMMDDhhmmss') + ".xlsx"; saveAs(new Blob([wbout], { type: "application/octet-stream" }), fileName);and i need to set these columns under (header 9-15) bold
if anyone find the solution let us know ,i am also facing same issue