This is a migrated thread and some comments may be shown as answers.

Export Telerik UI Blazor data to Excel/PDF

6 Answers 1307 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Medhanie
Top achievements
Rank 1
Veteran
Medhanie asked on 02 Jan 2020, 03:07 PM

Is there a component available to export data from telerik blazor/grid to Excel and PDF?

I have data displayed in a grid and we would like to add export to excel/PDF and printing functionality. 

 

If this is not yet available, is there any plan to include this functionality soon by any chance?

 

Thank you

 

6 Answers, 1 is accepted

Sort by
-1
Accepted
Kristian
Telerik team
answered on 02 Jan 2020, 04:29 PM

Hi Medhanie,

We have a public page where you can Vote for and Follow the progress of Export to Excel feature - https://feedback.telerik.com/blazor/1431614-export-grid-to-excel. I hope it will be ready for release around April.

The export to PDF Functionality is not yet planned. You can follow the progress of the feature here - https://feedback.telerik.com/blazor/1434269-export-grid-to-pdf. We prioritize the next features considering the community interest and you can raise the priority by voting for it.

The printing you can implement right now with a few lines of code. I created an example for you here - https://github.com/telerik/blazor-ui/tree/master/grid/print

 

Regards,
Kristian
Progress Telerik

 UI for Blazor
0
Aleksandr
Top achievements
Rank 1
Bronze
Bronze
Veteran
answered on 05 Nov 2020, 07:46 PM

Kristian, Marin,

i have found an example how to export Nested grid to excel

Export nested grid

this approach require data for nested grid be loaded together with parent, any way to make it work with dynamic loading data for nested grid?

0
Marin Bratanov
Telerik team
answered on 06 Nov 2020, 09:06 AM

Hello Aleksandr,

That's an example made by our customer Hussam that can cater to some cases.

There are a couple of important considerations why the grid cannot do what you ask:

  • The DetailTemplate is a template, it is not controlled by the grid. There is no feature in the framework that lets the grid get its template. This is why the excel export has a note in its documentation that templates are not exported.
  • The export operation happens synchronously, it needs all the data it will work on in order to create the loop over it to add rows. It could not possibly know what and when you need to fetch for a template it cannot use.

What I can suggest you look into is stepping on Hussam's example you found and adding the async data retrieval you want in the place of the nested grid creations. If you do that, I'd encourage you to post a second example in that folder to showcase this, we award such contributions with Telerik points.

Regards,
Marin Bratanov
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/.

0
Aleksandr
Top achievements
Rank 1
Bronze
Bronze
Veteran
answered on 06 Nov 2020, 09:14 AM

Marin,

thx a lot for the suggestion, I will think it over.

 

P.S - I asked it because we easily do it with jQuery grid 

 

0
Marin Bratanov
Telerik team
answered on 06 Nov 2020, 09:31 AM

Hi Aleksandr,

With jQuery, everything happens through a DOM manipulation, which is a bad practice in Blazor - the framework handles the shadow DOM and its manipulations. Thus, the two contexts are extremely different.

 

Regards,
Marin Bratanov
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/.

0
Aleksandr
Top achievements
Rank 1
Bronze
Bronze
Veteran
answered on 07 Nov 2020, 08:59 AM

so, made it possible using expand & collapse grid events, works as expected 

 

public void Collapse(GridRowCollapseEventArgs args)
        {
            Console.WriteLine("ReportSubscriptionViewModel Collapse");
            var reportModel = (SubscriptionReportModel)args.Item;
            var dataItem = Data.FirstOrDefault(_ => _.Id == reportModel.Id);
            dataItem.NestedData = new List<SubscriptionReportNestedModel>();
        }
 
        public async Task Expand(GridRowExpandEventArgs args)
        {
            Console.WriteLine("ReportSubscriptionViewModel Expand");
            var reportModel = (SubscriptionReportModel)args.Item;
            var dataItem = Data.FirstOrDefault(_ => _.Id == reportModel.Id);
            dataItem.NestedData = await _reportsApiService.GetSubscriptionNestedAsync(dataItem.Id);
            DoWorkHide();
        }
Tags
Grid
Asked by
Medhanie
Top achievements
Rank 1
Veteran
Answers by
Kristian
Telerik team
Aleksandr
Top achievements
Rank 1
Bronze
Bronze
Veteran
Marin Bratanov
Telerik team
Share this question
or