angularkendo-uikendo-gridexcel-templatekendo-angular-ui

Kendo-Angular : How to create kendo grid with template on columns?


How to create kendo grid with Kendo-Angular with export: I have kendo grid with columns. The columns have template. When I export grid to excel file the columns with template doesn't show

<kendo-grid [data]="dataSource"
            [sortable]="true"
            [pageable]="false"
            [filterable]="false"
            [selectable]="false">
  <ng-template kendoGridToolbarTemplate>
    <button type="button" kendoGridExcelCommand icon="file-excel"></button>
  </ng-template>
  <kendo-grid-column title="Name">
     <ng-template kendoGridCellTemplate let-dataItem>
        <span></span>
     </ng-template>
  </kendo-grid-column>
  <kendo-grid-column title="Category">
     <ng-template kendoGridCellTemplate let-dataItem>
        <span [innerHtml]="selectedProduct?.name"></span>
     </ng-template>
  </kendo-grid-column>
</kendo-grid>

Solution

  • Templates are not evaluated and exported to the Excel file:

    DOCS

    You can customize the exported workbook content and cell layout as demonstrated in the following example:

    EXAMPLE