Not Able to render button after excel to export?

1 Answer 88 Views
Excel Export
kapil
Top achievements
Rank 1
kapil asked on 23 Nov 2022, 12:17 PM

Hi Team,

I am working on the kendo-grid and implement export to excel but issue is that after excel data is visible but button not render on the excel can  you please tell me why button not visible on excel,check below attached stackblitz for reference.i am stuck above issue in last 3 days.please  help me regarding this issue?

 

https://stackblitz.com/edit/angular-ko29cm?file=src%2Fapp%2Fapp.component.ts

 

 

1 Answer, 1 is accepted

Sort by
1
Accepted
Martin
Telerik team
answered on 28 Nov 2022, 07:37 AM

Hi Kapil,

Thank you for the provided example.

This is one of the limitations of the Excel export functionality - during the export to Excel, the cell and detail column templates of the Grid are not evaluated:

https://www.telerik.com/kendo-angular-ui/components/grid/export/excel-export/#toc-known-limitations

That is because the Excel export functionality works with the data rather than with the cell's content to preserve the type information. 

To customize the desired column, the developer needs to change the created workbook by iterating each row/cell and applying the desired modifications to the desired cell. A similar approach of changing the initial cell content was shown here:

https://www.telerik.com/kendo-angular-ui/components/grid/export/excel-export/#toc-customizing-generated-workbooks

Here I want to mention that the ExcelExport component is based on the Workbook object provided by Microsoft in order to create excel files:

https://www.telerik.com/kendo-angular-ui/components/excel-export/api/Workbook/

The options provided by the Workbook API are limited and the supported cell values are Date, Number, String, and Boolean:

https://www.telerik.com/kendo-angular-ui/components/excel-export/api/WorkbookSheetRowCell/#toc-value

I hope this helps.

Regards,
Martin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

kapil
Top achievements
Rank 1
commented on 28 Nov 2022, 09:55 AM | edited

Hi Martin,

Thanks for the update but i have another major issue on export to excel.issue is that form server i received  date on  DD-MM-YYYY but after

Print date on excel its showing timestamp check below attached screenshot for reference and can you please why its showing timestamp instead of correct date?


 

Martin
Telerik team
commented on 01 Dec 2022, 08:03 AM

Hi Soni,

Thank you for the screenshot.

There are two available approaches to format the date values in Excel:

1. Customizing the generated Workbook as suggested above. Here is an example:

https://codesandbox.io/s/grid-excel-export-date-column-vk16iz

2. Using cellOptions of the <kendo-excelexport-column> and set the desired format:

<kendo-grid-excel fileName="Products.xlsx">
        <kendo-excelexport-column
          field="FirstOrderedOn"
          [cellOptions]="{ format: 'dd-MMM-yyyy' }"
        ></kendo-excelexport-column>
      </kendo-grid-excel>

More details can be found here:

https://www.telerik.com/kendo-angular-ui/components/grid/export/excel-export/#toc-specifying-exported-columns

Here is an example demonstrating the cellOptions property in action:

https://codesandbox.io/s/grid-excel-export-date-column-celloptions-zyrd0t

Regards

 

kapil
Top achievements
Rank 1
commented on 01 Dec 2022, 11:28 AM

thanks for the update martin
Tags
Excel Export
Asked by
kapil
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or