How can I format a number in an Excel file's cell and store its original value at the same time?

Viewed 165
 /**
   * To export as excel
   */
  public exportKagExcelFileFull() {
// Columns are the headers
    this.kagYearRenderColumns = this.kagYearFindColumns;
    const upperColumns = ['' ,'','','','','','','','','','','','','','kumuliert','',''];
    // unshift connects the columns and the rows (both parts of a table) with each other 
    this.kagYearExcelRenderRows.unshift(upperColumns); 
    this.kagYearExcelRenderRows.unshift(this.kagYearRenderColumns);
    //with aoa_to_sheet(rows) the rows are read by Excel
    const ws: XLSX.WorkSheet = XLSX.utils.aoa_to_sheet(this.kagYearExcelRenderRows);
    const wb: XLSX.WorkBook = XLSX.utils.book_new(); // Workbook is created
    XLSX.utils.book_append_sheet(wb, ws, 'Excel title'); // Workbook gets a title and the worksheets created above

    /* save to file */
    XLSX.writeFile(wb, 'ExcelFile.xlsx');
    this.currentKagExport.emit({ excel: true });
  }

enter image description here enter image description here

For instance, a number of 3,44001 in one of the cells (see left picture) must be transformed into 3,44. After that, if its chosen the original value (3,44001) has to be visible like in the right picture.

How can it be done?

0 Answers
Related