私の機能:
ExportTOExcel() {
const ws: XLSX.WorkSheet=XLSX.utils.table_to_sheet(document.getElementById('serversTable'));
const wb: XLSX.WorkBook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Servers');
/* save to file */
XLSX.writeFile(wb, 'myproject.xlsx');
}
私のテーブル:
<table id="serversTable" mat-table [dataSource]="serverArray" multiTemplateDataRows>
<ng-container matColumnDef="number">
<th mat-header-cell *matHeaderCellDef>Qty</th>
<td mat-cell ...>
...
</td>
</ng-container>
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef>name</th>
<td mat-cell ...>
...
</td>
</ng-container>
<!-- Other columns -->
<ng-container matColumnDef="osType">
<th mat-header-cell *matHeaderCellDef>OS</th>
<td mat-cell *matCellDef="let resourceGroup">
<img src="..\..\assets\images\... alt="myimage">
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let resourceGroup; columns: displayedColumns;" class="example-
element-row" [class.example-expanded-row]="expandedElement === resourceGroup
(click)="clickOnRowDisk(resourceGroup)">
</tr>
<tr mat-row *matRowDef="let row; columns: ['expandedDetail']" class="example-detail-row"></tr>
</table>
<img>
関数を実行すると、列「OS」が表示されますが、そのセルは空です.XLSXは自分でhtmlタグを読み取ることができないようです. これに対する解決策はありますか?alt
たぶん、彼に の財産を取るように言い<img>
ますか? (はいの場合、どのように)