I am Converting HTML to XLSX sheet in angular using SheetJS. But the width of each column is 256 only, I want to increase it
I have tried using ws[!cols] of ColInfo but not able to correctly implement it or set it ‘wch’ & ‘width’
let worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(this.exportNoteData); const workbook: XLSX.WorkBook = { Sheets: { 'data': worksheet }, SheetNames: ['data'] }; XLSX.writeFile(workbook, 'NoteExport.xls', { bookType: 'xls', type: 'buffer' });
I want to provide custom width for each column in generated excel, currently, I have 4 fixed columns
Advertisement
Answer
Use Booktype XLSX instead of XLS, to use ws[!col] in WriteFile
XLSX.writeFile(workbook, 'NoteExport.xls', { bookType: 'xlsx', type: 'buffer' });