Problems with exporting formatted, grouped, aggregated data to Excel or PDF from Grid

Hi,

I have the following problems when exporting data to Excel and/or PDF from the Blazor grid control (all versions):

  1. If the grid is grouped (2 levels) with group and footer templated aggregates, it throws an error "Object reference not set to an instance of an object" on export (both PDF and Excel). I have to call Grid.ClearGroupingAsync() before exporting to clear the groupings to get any export - and cannot get an export with groups.
  2. I can add totals by creating a footer in Excel, but the cells in the footer do not respect any of the formatting settings (e.g. NumberFormat="N2"). 
  3. There seems to be no way to output multiple worksheets in Excel (e.g. to control the grouping through code).
  4. There seems to be no way to add totals or any other aggregates when exporting to PDF.
  5. In Excel it is necessary to manually set the formats and widths column by column or it becomes a complete mess (no auto-fit to column width for example).

Some of the properties of the objects seem to imply e.g. that it is possible to export multiple worksheets within one workbook, but I have been unable to get any of these things working. 

I know you would like me to supply sample code to demonstrate the problem, but actually if you have working examples and/or documentation of the following that will be enough:

  1. An example of exporting to Excel grouped, aggregated and formatted data.
  2. An example of exporting multiple worksheets to one Excel workbook from the grid.
  3. An example of an Excel export with a footer containing aggregates - with formatted numbers.
  4. An example of a PDF export with a totals row at the bottom.

Many thanks,

Charles


2 Replies

CH Charles November 3, 2021 12:07 AM UTC

Just to add to this: I've tried working around the grouping error by applying a query filter in a loop and exporting for each filter value, but the entire dataset gets exported every time with no filters applied. It seems that actions like setting a query trigger a long-running async operation but there's no way to wait for them to complete or tell if they've completed. 



RN Rahul Narayanasamy Syncfusion Team November 4, 2021 03:16 AM UTC

Hi Charles, 

Greetings from Syncfusion. 

Query: An example of exporting to Excel grouped, aggregated and formatted data.  
& Query: An example of an Excel export with a footer containing aggregates - with formatted numbers.  
& Query: An example of a PDF export with a totals row at the bottom. 

We have validated your query and prepared a simple sample based on your requirement. In this sample, we have perform the excel export for the grouped and aggregated grid. While exporting the Grid the footer aggregate is added in both excel and pdf export. Find the below sample for your reference. 


Reference

Query: An example of exporting multiple worksheets to one Excel workbook from the grid. 

We have validated your query and we need some details regarding this query. Could you please share the below details. It will be helpful to validate and provide a better solution. 

  • Whether did you want to add additional sheets in excel workbook while exporting?
       (or) 
  • Whether did you want to export multiple Grids in the same  excel workbook?

Please let us know if you have any concerns. 

Regards, 
Rahul 


Loader.
Up arrow icon