ngx-excel-export icon indicating copy to clipboard operation
ngx-excel-export copied to clipboard

How take column width to my file

Open pacograndez opened this issue 8 years ago • 1 comments

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; }

pacograndez avatar Oct 13 '17 22:10 pacograndez

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);

shlomiah avatar Oct 25 '18 13:10 shlomiah