How to format a cell header in xlsx angular

Discussão em 'Angular' iniciado por ABC, Novembro 10, 2024.

  1. ABC

    ABC Guest

    How to format a cell in angular using xlsx or the cellStyles.

    here's the code.

    list.component.ts

    const ws = XLSX.utils.json_to_sheet(reportData);
    ws['!cols'] = [];
    Object.keys(reportData[0]).forEach((cell: any) => {
    const colWidth =
    cell === 'Date'
    ? 120
    : cell === 'Time'
    ? 100
    : cell === 'Location'
    ? 200
    : cell === 'Temperature'
    ? 80
    : cell === 'Humidity'
    ? 80
    : 100;
    ws['!cols'].push({
    wpx: colWidth
    });
    });

    XLSX.utils.book_append_sheet(wb, ws, this.roomTitle);
    XLSX.writeFile(
    wb,
    `${fileName}.xlsx`,
    { cellStyles: true },
    );


    what I'm trying to do here is to format it into BOLD TEXT the header which is the Date, Time, Location, Temperature and Humidity

    Continue reading...

Compartilhe esta Página