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
public exportAsExcelFile(json: any[], excelFileName: string): void {
const header = Object.keys(json[0]); // columns name
var wscols = [];
for (var i = 0; i < header.length; i++) { // columns length added
wscols.push({ wch: header[i].length + 5 })
}
const worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(json);
worksheet["!cols"] = wscols;
}