Export a grouped grid to PDF - Empty columns and crash
Hello,
I have an issue when i try to export a grouped grid in PDF.
I have two grid with grouping in my project and both have issues. The first one crash with the following error message :
Unable to cast object of type 'Syncfusion.Blazor.Data.Group`1[MyModel]' to type 'MyModel'.
The second one work but the export isn't grouped.
I join the picture of the code for my grid, the grid and the export i have.
Pablo
Attachment: code_5b60a3a1.png
Hi Pablo Neussaint,
Based on
the shared details, we understand that you are encountering a problem you have
faced the issue Grid grouping with PDF Export. But we were unable to reproduce
the reported issue on our end. For your reference, we have attached a screenshot
and a sample.
Screenshots:
|
|
To further investigate the issue you are facing, we kindly request the following additional details:
- Could you share a video demonstration of the issue you are experiencing?
- To help us analyze the problem effectively, could you provide a simple, reproducible sample that demonstrates the issue?
- Could you please share with us your attempt to replicate the issue using the attached sample?
These details will help us validate and resolve the reported issue more efficiently.
Regards,
Prathap Senthil
Hi Prathap,
Thanks for your reply.
I would like to clarify that your own sample already reproduces the issue on our side.
When grouping is enabled, the PDF export shows one or several extra empty columns on the left side of the exported table.
The number of empty columns depends on the number of grouping levels:
- 1 grouped column → 1 empty column in PDF
- 2 grouped columns → 2 empty columns
- etc.
In the UI, the grid displays correctly.
In the PDF, the grouped columns are interpreted as blank columns.
Let me know if you want me to attach my anonymized reproduction sample.
Regards,
Léo
Thanks for the update ,
When grouping is applied in the DataGrid, the component internally renders
additional structural elements, such as expand and collapse icons and
indentation levels, to visually represent the group hierarchy. These structural
columns are part of how the grid organizes and displays grouped data in the UI,
even though they may not appear as traditional data columns.
During PDF export, the grid preserves this internal structure exactly as rendered, which results in these indentation columns appearing as empty cells in the exported document. This behavior is by design and not an issue. Currently, it is not possible to remove or hide these empty cells during export. Thank you for your understanding.
Hi,
Before going further, here is a short explanation of how our real page is structured, anonymized so you can understand the architecture without exposing any internal details.
Our page is composed of three main parts:
1. A .razor page with a grouped Grid using aggregates
- The grid is bound to a simple in‑memory
List<T> - Grouping is enabled on a single key
- Several aggregate templates are defined (Sum / Max / Min)
- A few columns have cell templates
This corresponds to a standard Syncfusion Grid scenario with local data + grouping + aggregate templates.
2. A .razor.cs code‑behind (partial class)
- On initialization, the page calls an API and fills the
List<T> - The grid is refreshed after loading
- A toolbar is dynamically built (Search, ColumnChooser, Export, ClearFilter)
- Filtering/Search/Grouping are fully client-side (local data)
So the grid uses Syncfusion’s default local adaptor (BlazorAdaptor), not DataManager.
3. A custom Export button component
We use a custom <MyExportButton> (anonymized) that internally calls:
Grid.ExportToPdfAsync()Grid.ExportToExcelAsync()Grid.ExportToCsvAsync()
Additionally, the button includes some logic to detect filtering, paging, or exported row limits.
This component does not modify the internal behavior of Syncfusion exports; it simply delegates to the built‑in export APIs.
Key point
Even with this very normal setup:
- Grouping alone works
- Aggregates alone work
- But grouping + aggregate templates together break the PDF export
Removing the aggregates immediately fixes the export.
No custom adaptor, no remote binding, no special configuration — just a local List<T> with grouping + aggregates.
I can't give a playground because on playground i can't reproduce the
Thanks,
Léo
Thank you for the update.
Based on the details you shared, as we explained earlier, when grouping is applied in the DataGrid, the component internally renders additional structural elements—such as expand/collapse icons and indentation levels—to visually represent the group hierarchy. During PDF export, the grid preserves this structure exactly as it appears in the UI. As a result, these indentation columns show up as empty cells in the exported PDF. This behavior is expected and by design.
However, you mentioned that using grouping and aggregate templates together breaks the PDF export. We attempted to reproduce the issue on our side, but we were not able to replicate it. Please refer to the attached sample and screenshot for your reference.
Sample: Check the attachment.
Screenshot:
Exported document:
To help us analyze the issue more effectively, kindly provide the following:
- A simple, reproducible sample along with duplicate data so we can accurately identify the problem and provide a quick resolution.
- Could you please share with us your attempt to replicate the issue using the attached sample?
- Could you please let us know if you encountered any exceptions on your end? If yes, kindly share the details of the issue.
- Could you please share us the NuGet version used on your end?
The above details will greatly help us validate the reported issue on our end and provide you with a solution as soon as possible.
Attachment: DataGridGrouping_Aggregate_fd5b5b11.zip
- 5 Replies
- 4 Participants
-
PN Pablo Neussaint
- Feb 18, 2026 03:20 PM UTC
- Mar 18, 2026 11:57 AM UTC