Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

209
Visualizações
cómo mostrar valores de matriz multidimensional en pantalla

ingrese la descripción de la imagen aquí

 // aap.component.html <ul *ngFor="let items of exceltoJson" > <li> {{ items }} </li> </ul> <input type="file" (change)="onFileChange($event)"> // app.component.ts onFileChange(event: any) { this.exceltoJson = {}; /* wire up file reader */ const target: DataTransfer = <DataTransfer>(event.target); const reader: FileReader = new FileReader(); reader.readAsBinaryString(target.files[0]); this.exceltoJson['filename'] = target.files[0].name; reader.onload = (e: any) => { /* create workbook */ const binarystr: string = e.target.result; const wb: XLSX.WorkBook = XLSX.read(binarystr, { type: 'binary' }); for (var i = 0; i < wb.SheetNames.length; ++i) { const wsname: string = wb.SheetNames[i]; const ws: XLSX.WorkSheet = wb.Sheets[wsname]; const data = XLSX.utils.sheet_to_json(ws); this.exceltoJson[`sheet${i + 1}`] = data; } console.log(this.exceltoJson); }; }
Hola, usando el código anterior, obtengo los datos en la consola, pero quiero mostrarlos en la pantalla en forma tabular. Estos datos se obtienen de varias hojas de un solo archivo.

Intenté forEach, JSON.parse() pero no pude tener éxito. ¿Alguien puede ayudarme a mostrar usando angular?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Considere que conoce todas las hojas y están arregladas.

Puedes

 <ul *ngFor="let items of exceltoJson[1]" > <li> {{ items }} </li> </ul> <ul *ngFor="let items of exceltoJson[2]" > <li> {{ items }} </li> </ul> <input type="file" (change)="onFileChange($event)">

O puede usar un ngfor dentro de ngfor como sugirió @ataerg

 <div *ngFor="let sheets of exceltoJson"> <ul *ngFor="let items of sheets " > <li> {{ items }} </li> </ul> </div>
about 4 years ago · Juan Pablo Isaza Relatório

0

Creo que la solución es que debe usar 2 * ngFor en el archivo component.html.

debe ser como:

<.. *ngFor="let items of exceltoJson"> <.. *ngFor="let item of items"> </..> </..>

¡Espero haberte ayudado!

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda