Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

chore(grid): refactor export notes #2835

Merged
merged 28 commits into from
Mar 28, 2025
Merged
Changes from 18 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
63cb656
chore(grid): refactor export notes
ntacheva Mar 13, 2025
ee4b758
chore(Grid): add kb for showing loader during export
ntacheva Mar 17, 2025
ea3792a
chore(grid): kb for load cyrillic fonts when exporting to pdf
ntacheva Mar 19, 2025
f5f0262
chore(grid): add example for loading cyrillic fonts
ntacheva Mar 20, 2025
c563727
chore(grid): updates
ntacheva Mar 20, 2025
d2a884d
Update components/grid/export/excel.md
ntacheva Mar 25, 2025
946a8bd
Update knowledge-base/grid-load-cyrillic-fonts-in-pdf-export.md
ntacheva Mar 25, 2025
74df580
Update knowledge-base/grid-show-loader-while-exporting.md
ntacheva Mar 25, 2025
b1f0c08
Update knowledge-base/grid-show-loader-while-exporting.md
ntacheva Mar 25, 2025
f614827
Update components/grid/export/excel.md
ntacheva Mar 25, 2025
0182f52
Update components/grid/export/overview.md
ntacheva Mar 25, 2025
615236d
Update components/grid/export/overview.md
ntacheva Mar 25, 2025
7185cad
Update components/grid/export/overview.md
ntacheva Mar 25, 2025
624c530
Update knowledge-base/grid-load-cyrillic-fonts-in-pdf-export.md
ntacheva Mar 25, 2025
88acdfc
Update components/grid/export/pdf.md
ntacheva Mar 25, 2025
d821ee1
Update knowledge-base/grid-load-cyrillic-fonts-in-pdf-export.md
ntacheva Mar 25, 2025
4bb1009
chore(grid): address feedback
ntacheva Mar 25, 2025
2b706ca
Update components/grid/export/overview.md
ntacheva Mar 25, 2025
624e886
Update components/grid/export/overview.md
ntacheva Mar 25, 2025
d646ccf
Update components/grid/export/overview.md
ntacheva Mar 25, 2025
3693bcd
Update components/grid/export/overview.md
ntacheva Mar 25, 2025
cca2f0a
Update components/grid/export/overview.md
ntacheva Mar 25, 2025
f13b5bc
Update components/grid/export/overview.md
ntacheva Mar 25, 2025
9e19c5f
Update components/grid/export/pdf.md
ntacheva Mar 25, 2025
511ea83
Update components/grid/export/overview.md
ntacheva Mar 25, 2025
4adc76f
chore(grid): address feedback
ntacheva Mar 25, 2025
2c3ae2a
chore(grid): final updates
ntacheva Mar 28, 2025
998960d
chore(grid): update note
ntacheva Mar 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 0 additions & 78 deletions _contentTemplates/grid/export.md

This file was deleted.

33 changes: 17 additions & 16 deletions components/grid/export/csv.md
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ description: Export to CSV the Grid for Blazor.
slug: grid-export-csv
tags: telerik,blazor,grid,export,csv
published: True
position: 1
position: 3
---

# Grid CSV Export
@@ -17,9 +17,9 @@ When you click the Export button, your browser will receive the resulting file.
#### In This Article

- [Basics](#basics)
- [Limitations](#limitations)
- [Programmatic Export](#programmatic-export)
- [Customization](#customization)
- [Notes](#notes)
- [See Also](#see-also)

## Basics
@@ -41,6 +41,8 @@ Optionally, you can also set the `GridCsvExport` tag settings under the `GridExp
| `FileName` | `string` | The name of the file. The grid will add the `.csv` extension for you. |
| `AllPages` | `bool` | Whether to export the current page only, or the entire data from the data source. |

> Before enabling the export feature, ensure that you are familiar with [its specifics](slug:grid-export-overview#how-the-export-works).

>caption Export the Grid to CSV - Example

````RAZOR
@@ -99,6 +101,12 @@ Optionally, you can also set the `GridCsvExport` tag settings under the `GridExp
}
````

## Limitations

The CSV export has the following limitation:

* Column widths are not applied because a CSV document does not have such a concept. You can use any units in the grid itself, they will not be reflected in the exported document.<br/>If you need to export columns with specific widths, consider [exporting to an Excel file](slug:grid-export-excel).

## Programmatic Export

You can programmatically invoke the export feature of the Grid, by using the following methods exposed on the `@ref` of the Grid:
@@ -198,20 +206,13 @@ For more advanced customizations (such as coloring the headers, bolding the titl

[Read more about how to customize the exported file...](slug:grid-export-events)

## Notes

The CSV export has the following specifics:

* Column widths are not applied because a CSV document does not have such a concept. You can use any units in the grid itself, they will not be reflected in the exported document. If you need to add such structure, consider [exporting to an Excel file](slug:grid-export-excel).
* 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 will be ignored. The headers will be the `Title` of the column, the data is the data from the `Field`. If you need additional information, see if you can add it in a Field in the model, or create your own Excel file. Find a <a href="https://feedback.telerik.com/blazor/1485764-customize-the-excel-file-before-it-gets-to-the-client" target="_blank">project example on how to generate your own exported file</a>.

@[template](/_contentTemplates/grid/export.md#export-common-notes)

## See Also

* [Live Demo: Grid Export](https://demos.telerik.com/blazor-ui/grid/export)
* [Custom cell formatting of the exported file with RadSpreadProcessing](slug:grid-kb-custom-cell-formatting-with-radspreadprocessing)
* [Custom cell formatting of the exported file with RadSpreadStreamProcessing](slug:grid-kb-custom-cell-formatting-with-radspreadstreamprocessing)
* [Format numbers and dates in the exported CSV file from the Grid](slug:grid-kb-number-formatting-of-the-csv-export)
* [Change the default CSV delimiter (comma) during Grid export](slug:grid-kb-csv-export-change-field-delimiter)
* [Blazor Grid](slug:grid-overview)
* [Live Demo: Grid Export](https://demos.telerik.com/blazor-ui/grid/export)
* [Custom cell formatting of the exported file with RadSpreadProcessing](slug:grid-kb-custom-cell-formatting-with-radspreadprocessing)
* [Custom cell formatting of the exported file with RadSpreadStreamProcessing](slug:grid-kb-custom-cell-formatting-with-radspreadstreamprocessing)
* [Format numbers and dates in the exported CSV file from the Grid](slug:grid-kb-number-formatting-of-the-csv-export)
* [Change the default CSV delimiter (comma) during Grid export](slug:grid-kb-csv-export-change-field-delimiter)
* [Sowing a Loader While Exporting the Grid](slug:grid-kb-show-loader-while-exporting)
* [Blazor Grid](slug:grid-overview)
24 changes: 12 additions & 12 deletions components/grid/export/excel.md
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ description: Export to Excel the Grid for Blazor.
slug: grid-export-excel
tags: telerik,blazor,grid,export,excel
published: True
position: 1
position: 5
---

# Grid Excel Export
@@ -18,9 +18,9 @@ When you click the Export button, your browser will receive the resulting file.
#### In This Article

- [Basics](#basics)
- [Requirements](#requirements)
- [Programmatic Export](#programmatic-export)
- [Customization](#customization)
- [Notes](#notes)

## Basics

@@ -41,6 +41,8 @@ Optionally, you can also set the `GridExcelExport` tag settings under the `GridE
| `FileName` | `string` | The name of the file. The grid will add the `.xslx` extension for you. |
| `AllPages` | `bool` | Whether to export the current page only, or the entire data from the data source. |

> Before enabling the export feature, ensure that you are familiar with [its specifics](slug:grid-export-overview#how-the-export-works).

>caption Export the Grid to Excel - Example

````RAZOR
@@ -99,6 +101,13 @@ Optionally, you can also set the `GridExcelExport` tag settings under the `GridE
}
````


## Requirements

The Excel export has the following requirement:

* When setting column `Width`, use only `px`. Excel cannot parse units different than `px` (e.g., `rem` or `%`) and renders a collapsed (hidden) column with zero width. This is an Excel limitation.

## Programmatic Export

You can programmatically invoke the export feature of the Grid, by using the following methods exposed on the `@ref` of the Grid:
@@ -199,19 +208,10 @@ For more advanced customization (such as coloring the headers or bolding the tit

Read more about how to [customize the exported file](slug:grid-export-events).

## Notes

The Excel export has the following specifics:

* Excel does not understand units different than `px` for the column `Width`, and if you use them (such as `rem` or `%`), it will fail to parse them and will render a collapsed (hidden) column with zero width.
* 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 will be ignored. The headers will be the `Title` of the column, the data is the data from the `Field`. If you need additional information, see if you can add it in a Field in the model, or create your own Excel file. Find a <a href="https://feedback.telerik.com/blazor/1485764-customize-the-excel-file-before-it-gets-to-the-client" target="_blank">project example on how to generate your own exported file</a>. Find additional information on how to [export an image that is rendered in a Grid column template](slug:grid-export-image-column-excel).

@[template](/_contentTemplates/grid/export.md#export-common-notes)


## See Also

* [Live Demo: Grid Export](https://demos.telerik.com/blazor-ui/grid/export)
* [Custom Cell Formatting of the Exported File with RadSpreadProcessing](slug:grid-kb-custom-cell-formatting-with-radspreadprocessing)
* [Custom Cell Formatting of the Exported File with RadSpreadStreamProcessing](slug:grid-kb-custom-cell-formatting-with-radspreadstreamprocessing)
* [Showing a Loader While Exporting the Grid](slug:grid-kb-show-loader-while-exporting)
* [Blazor Grid](slug:grid-overview)
62 changes: 62 additions & 0 deletions components/grid/export/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: Overview
page_title: Grid - Export Overview
description: Export basics for the Grid for Blazor.
slug: grid-export-overview
tags: telerik, blazor, grid, export
published: True
position: 1
---

# Blazor Grid Export

The Grid for Blazor provides a built-in functionality to export the data to:
* [CSV](slug:grid-export-csv)
* [Excel](slug:grid-export-excel)
* [PDF](slug:grid-export-pdf)

Before proceeding to the dedicated export articles, ensure you are familiar with the following information:

## How the Export Works

The Grid export feature has the following specifics:

* If the Grid is using `OnRead` and is exporting all pages, it will fire an additional `OnRead` event at the time of exporting, with a request `PageSize` of `0`. 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](slug:grid-kb-show-loader-while-exporting).

## Requirements

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 your `Startup.cs` file, for example:

````C#.skip-repl
services.AddServerSideBlazor().AddHubOptions(o =>
{
o.MaximumReceiveMessageSize = 1024 * 1024; // 1MB
});
````

## Limitations

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 the `Field`. If you need additional information, see if you can add it in a Field in the model, or create your own file. Find a <a href="https://feedback.telerik.com/blazor/1485764-customize-the-Pdf-file-before-it-gets-to-the-client" target="_blank">project example on how to generate your own exported file</a>. Find additional information on how to [export an image that is rendered in a Grid column template](slug:grid-export-image-column-excel).
* `bool` fields are exported as `TRUE` or `FALSE` 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, and `Convert.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).

## Customization

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](slug:grid-export-events).

## See Also

* [Grid Export to CSV](slug:grid-export-csv)
* [Grid Export to Excel](slug:grid-export-excel)
* [Grid Export to PDF](slug:grid-export-pdf)
* [Live Demo: Grid Export](https://demos.telerik.com/blazor-ui/grid/export)
Loading