title: Promise for a void method
body: <p>I have a implemented a method to download a document into an Excel spreadsheet in Angular as below. Can someone please let me know how to implement promise for below <code>void</code> methods.</p>
  <p><code>ExportService</code> class:</p>
  <pre class="lang-js prettyprint-override"><code>export class ExportService {
  
      constructor() { }
  
      fileType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
      fileExtension = '.xlsx';
  
      public exportExcel(jsonData: any[][], fileName: string): void {
          const x: XLSX.WorkSheet = XLSX.utils.json_to_sheet(jsonData[0]);
          const z: XLSX.WorkSheet = XLSX.utils.json_to_sheet(jsonData[1]);
  
          const b: XLSX.WorkBook = {
              Sheets: {
                  'product': x,
                  'sales': z
              },
              SheetNames: ['product', 'sales']
          };
          const excelBuffer: any = XLSX.write(b, { bookType: 'xlsx', type: 'array' });
  
          this.saveExcelFile(excelBuffer, fileName);
      }
  
      private saveExcelFile(buffer: any, fileName: string): void {
          const data: Blob = new Blob([buffer], { type: this.fileType });
          FileSaver.saveAs(data, fileName + this.fileExtension);
      }
  }
  </code></pre>
  <p>The export method in the component is as below.</p>
  <pre class="lang-js prettyprint-override"><code>    export() {
          this.callProgress = true;
          this.progressText = &quot;&quot;;
      
          this.salesProductForABC().then(() =&gt; {
              let products: Array&lt;Array&lt;any&gt;&gt; = [];
              products.push(this.productContent, this.salesProductContent);
      
              let month = new Date().getUTCMonth() + 1;
              let day = new Date().getUTCDate();
              let year = new Date().getUTCFullYear();
              let fileName = `${month}${day}${year}`;
              this.exportService.exportExcel(products, fileName)
              this.callProgress = false;
          })
        }
  ``
  
  `
  </code></pre>