Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
1.2 kB
3
Indexable
Never
download(x: unknown[]){

    const wb1 = XLSX.utils.book_new();
    var c=0;
      this.cargadatos.forEach((element: unknown[]) => {
      this.listamedidorRecord[c].recordname=this.listamedidorRecord[c].recordname.replace('\\','');
      this.listamedidorRecord[c].recordname=this.listamedidorRecord[c].recordname.replace('/','');
      this.listamedidorRecord[c].recordname=this.listamedidorRecord[c].recordname.replace('?','');
      this.listamedidorRecord[c].recordname=this.listamedidorRecord[c].recordname.replace('*','');
      this.listamedidorRecord[c].recordname=this.listamedidorRecord[c].recordname.replace('[','');
      this.listamedidorRecord[c].recordname=this.listamedidorRecord[c].recordname.replace(']','');
      XLSX.utils.book_append_sheet(wb1, XLSX.utils.json_to_sheet(element),this.listamedidorRecord[c].recordname);
      c++;
      if(this.cargadatos.length==c && !this.descargando){
        console.error('entro en descarga----------------')
        const excelBuffer: any = XLSX.write(wb1, { bookType: 'xlsx', type: 'array' });
        this.saveExcelFile(excelBuffer, "prueba");
      }
    
    });   
  }