title: Export to Excel in Angular2 with data formatting
body: <p>I have a function for exporting to Excel. I have used <code>file-saver</code> and <code>xlsx</code> npm packages and it works perfectly. Here is the code where I call <code>exportAsExcelFile</code>:</p>
  
  <pre><code>this.httpservice.getSales_ByBillNo(this.branchUID, this.billNoUrl, this.fromDate, this.toDate)
                  .subscribe((data1: Observable&lt;any&gt;) =&gt; {
                      this.billNoResults = data1;
                      this.httpservice.exportAsExcelFile(this.billNoResults,'BillNo', 'DayWiseSalesByTotalReport');
                  });
  </code></pre>
  
  <p>Here is the <code>exportAsExcelFile</code> function in <strong>Service.ts</strong>:</p>
  
  <pre><code>exportAsExcelFile(json: any[],dataOne:string, excelFileName: string): void {
  
      const worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(json);
      const workbook: XLSX.WorkBook = { Sheets: { dataOne: worksheet }, SheetNames: [dataOne] };
  
      const excelBuffer: any = XLSX.write(workbook, { bookType: 'xlsx', bookSST: false, type: 'binary' });
  
      let buf = new ArrayBuffer(excelBuffer.length);
      let view = new Uint8Array(buf);
      for (var i = 0; i != excelBuffer.length; ++i) view[i] = excelBuffer.charCodeAt(i) &amp; 0xFF;
  
      const data: Blob = new Blob([buf], {
          type: EXCEL_TYPE
      });
  
      saveAs(data, excelFileName + new Date() + EXCEL_EXTENSION)
  }
  </code></pre>
  
  <p>The above function works perfect. In the Excel, I have dates and other value columns. Here is the screen shot of it:</p>
  
  <p><img src="https://i.stack.imgur.com/YeObb.png" alt="Export to Excel"></p>
  
  <p>But I need <code>BillDate</code> to be formatted as <code>dd/mm/yyyy</code>. <code>Qty</code> and <code>Value</code> should be formatted as decimal, with 2 digits after the decimal point.</p>
  
  <p>Can someone please help me with this issue?</p>
  
  <p>Thanks in advance.</p>
  
  <p>Edit: I have attached the <code>json</code> here.</p>
  
  <p><a href="https://i.stack.imgur.com/ibw6Q.png" rel="nofollow noreferrer">json</a></p>