Search code examples
ionic3

Ionic v3: How to copy ion-grid table to excel


I’m trying to copy a girded data to excel as a table.

this is my code

<ion-grid>
   <ion-row *ngFor="let row of ['', '', '', '', '', '']; let i=index;">
      <ion-col col-3 *ngFor="let col of ['', '', '', '']; let j=index;" style="border:1px solid black;">
        TEST {{i}}.{{j}}
      </ion-col>
   </ion-row>
</ion-grid>

When I paste the table into excel, it print as a one line instated of table.


Solution

  • I think there is no other than this way

    <table width="100%">
      <tr *ngFor="let row of ['', '', '', '', '', '']; let i=index;">
        <td text-center *ngFor="let col of ['', '', '', '']; let j=index;" style="border:1px solid black;">
          TEST {{i}}.{{j}}
        </td>
      </tr>
    </table>