-1

I'm trying to bold the column titles from an excel worksheet, using the json_to_sheet function. How can i bold the ID,or format the first cell?

var ws = XLSX.utils.json_to_sheet([{ID:"ID"}], {header: ["ID"], skipHeader: true});
let excelFileName='Exported Serviceberichte';  
const workbook: XLSX.WorkBook = { Sheets: { 'data': ws }, SheetNames: ['data'] };  
const excelBuffer: any = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });  
this.saveAsExcelFile(excelBuffer, excelFileName);  

ID

2

3

4

This is how it should look.

user16766771
  • 69
  • 1
  • 2
  • 3

1 Answers1

0

How to Bold Specific Cell 'A1' for example:

workSheet.Cells[1, 1].Font.Bold = true;

More examples: https://stackoverflow.com/a/19883924/15439733

Joosep Parts
  • 5,372
  • 2
  • 8
  • 33
  • When I'm trying this in Angular, it says that the first 1('Left side of comma operator is unused and has no side effects.'). When I get rid of the first one I get the error that 'Cannot read properties of undefined (reading 1)'. Is there a better way to do it in Typescript? – user16766771 Mar 28 '22 at 08:13