title | page_title | description | slug | tags | published | position |
---|---|---|---|---|---|---|
Overview |
Grid - Export Overview |
Export basics for the Grid for Blazor. |
grid-export-overview |
telerik, blazor, grid, export |
true |
1 |
The Grid for Blazor provides a built-in functionality to export the data to:
- CSV
- Excel
Before proceeding to the dedicated export articles, ensure you are familiar with the following information:
The Grid export feature has the following specifics:
- If the Grid is using
OnRead
and is exporting all pages, it will fire an additionalOnRead
event at the time of exporting, with a requestPageSize
of0
. This will enable the component to obtain all data. - The time for export will be longer if:
- The Grid has a lot of records and/or
- The Grid is in a Client-side Blazor (WebAssembly) where all the code runs in the browser. At the time of writing, it is considerably slower than server-side Blazor, and it only has one actual thread.
tip While the file is being generated, the UI will be unresponsive, so you may want to show a loading sign to the user during the export process.
The Grid export feature has the following requirements:
- With Server-side Blazor, the file may become larger than the default SignalR connection limit, and this can disconnect the client and result in an error. Generally, this requires quite a lot of data to happen, but you may need to increase the size limit of the connection in the
ConfigureServices
method of yourStartup.cs
file, for example:
services.AddServerSideBlazor().AddHubOptions(o =>
{
o.MaximumReceiveMessageSize = 1024 * 1024; // 1MB
});
The Grid export feature has the following limitations:
- Templates are not exported, because there is no provision in the framework for getting them at runtime. If a column, header or group header/footer has a template or aggregates, it is be ignored. The headers are the
Title
of the column, the data is the data from theField
. If you need additional information, see if you can add it in a Field in the model, or create your own file. Find a project example on how to generate your own exported file. Find additional information on how to export an image that is rendered in a Grid column template. bool
fields are exported asTRUE
orFALSE
strings, because there is no native boolean data type in the exported formats and these string values are the most common ones used in data and macros.- Date and number formats are exported in the following format:
mm/dd/yyyy hh:mm:ss
plus the current app culture AM/PM specifier for dates, andConvert.ToDouble(value)
for numbers (which uses the current thread culture). The Excel date formats are different than .NET date formats and Excel may not always recognize the column as dates, for example, if the entire date format from the .NET culture is used. To customize the date and number formats, use the [Export Events](slug: grid-export-events). - The Grid exports only
<GridColumn>
instances. Other types of columns are not exported (for example: command, checkbox, hierarchy, group and row-drag columns).
The Grid allows customization of the exported files - determine the desired data to be exported, changing the number/date formats and more. For such customizations, handle the export events.
- Grid Export to CSV
- Grid Export to Excel
- Grid Export to PDF
- Live Demo: Grid Export