About Cell Styling with XLSX in Angular

Viewed 744

I´m using the xlsx npm module to export a json object to an excel file. This is my code with Angular::

  const worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet([]);

  XLSX.utils.sheet_add_aoa(worksheet, [['CLIENTE', name, 'TELEFONO', phone], ['DIRECCION', address, 'NIT', nit]], {origin: 'A1'});
  XLSX.utils.sheet_add_json(worksheet, json, {origin: 'A4'});
 
  const workbook: XLSX.WorkBook = { Sheets: { 'data': worksheet }, SheetNames: ['data'] };
  const excelBuffer: any = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
  this.saveAsExcelFile(excelBuffer, excelFileName);

How could I do to format some Cell ('A1' o 'B1') for example with some color and style like Bold?

0 Answers
Related