ngx-excel-export
ngx-excel-export copied to clipboard
How take column width to my file
Hi Luwojtaszek,
I have a query, I'm trying to give width to my column with the following code, but it does not work for me. Thanks for the reply.
const worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(json); this.colSubDiario(worksheet.A1); private colSubDiario(col: XLSX.ColInfo) { col.width = 100; }
I don't know how to set a column width but you can change the base column width to all columns like that:
const worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(json); const workbook: XLSX.WorkBook = { Sheets: { 'data': worksheet }, SheetNames: ['data'] }; const opts: any = { sheetFormat: { baseColWidth: '20' } }; XLSX.writeFile(workbook, ExcelService.toExportFileName(excelFileName), opts);