You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _contentTemplates/grid/export.md
+1-12Lines changed: 1 addition & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,8 @@
1
1
#export-common-notes
2
-
*`bool` fields are exported as `TRUE` or `FALSE` strings, because there is no native boolean data type in exported format and these string values are the most common ones used in data and macros.
3
2
4
-
* Date and number formats are exported with 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.
5
3
6
-
* The Grid exports only `<GridColumn>` instances. Other types of columns are not exported, for example command, checkbox, hierarchy, group and row-drag columns.
7
4
8
-
* 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.
9
5
10
-
* 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:
11
-
12
-
````C#.skip-repl
13
-
services.AddServerSideBlazor().AddHubOptions(o =>
14
-
{
15
-
o.MaximumReceiveMessageSize = 1024 * 1024; // 1MB
16
-
});
17
-
````
18
6
19
7
* With Client-side Blazor (WebAssembly), all the code runs in the browser and, at the time of writing, is considerably slower than server-side Blazor, and it only has one actual thread. This means that while the file is being generated, the UI will be unresponsive, so you may want to show a loading sign to the user through the `OnClick` handler of the command button, something like:
Copy file name to clipboardExpand all lines: components/grid/export/csv.md
+8-9Lines changed: 8 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ description: Export to CSV the Grid for Blazor.
5
5
slug: grid-export-csv
6
6
tags: telerik,blazor,grid,export,csv
7
7
published: True
8
-
position: 1
8
+
position: 3
9
9
---
10
10
11
11
# Grid CSV Export
@@ -17,6 +17,7 @@ When you click the Export button, your browser will receive the resulting file.
17
17
#### In This Article
18
18
19
19
-[Basics](#basics)
20
+
-[Limitations](#limitations)
20
21
-[Programmatic Export](#programmatic-export)
21
22
-[Customization](#customization)
22
23
-[Notes](#notes)
@@ -41,6 +42,8 @@ Optionally, you can also set the `GridCsvExport` tag settings under the `GridExp
41
42
|`FileName`|`string`| The name of the file. The grid will add the `.csv` extension for you. |
42
43
|`AllPages`|`bool`| Whether to export the current page only, or the entire data from the data source. |
43
44
45
+
> Before enabling the export feature, ensure you are familiar with [its specifics](slug:grid-export-overview#how-it-works).
46
+
44
47
>caption Export the Grid to CSV - Example
45
48
46
49
````RAZOR
@@ -99,6 +102,10 @@ Optionally, you can also set the `GridCsvExport` tag settings under the `GridExp
99
102
}
100
103
````
101
104
105
+
## Limitations
106
+
107
+
* 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).
108
+
102
109
## Programmatic Export
103
110
104
111
You can programmatically invoke the export feature of the Grid, by using the following methods exposed on the `@ref` of the Grid:
@@ -198,14 +205,6 @@ For more advanced customizations (such as coloring the headers, bolding the titl
198
205
199
206
[Read more about how to customize the exported file...](slug:grid-export-events)
200
207
201
-
## Notes
202
-
203
-
The CSV export has the following specifics:
204
-
205
-
* 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).
206
-
* 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 <ahref="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>.
Copy file name to clipboardExpand all lines: components/grid/export/excel.md
+9-12Lines changed: 9 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ description: Export to Excel the Grid for Blazor.
5
5
slug: grid-export-excel
6
6
tags: telerik,blazor,grid,export,excel
7
7
published: True
8
-
position: 1
8
+
position: 5
9
9
---
10
10
11
11
# Grid Excel Export
@@ -18,9 +18,9 @@ When you click the Export button, your browser will receive the resulting file.
18
18
#### In This Article
19
19
20
20
-[Basics](#basics)
21
+
-[Requirements](#requirements)
21
22
-[Programmatic Export](#programmatic-export)
22
23
-[Customization](#customization)
23
-
-[Notes](#notes)
24
24
25
25
## Basics
26
26
@@ -41,6 +41,8 @@ Optionally, you can also set the `GridExcelExport` tag settings under the `GridE
41
41
|`FileName`|`string`| The name of the file. The grid will add the `.xslx` extension for you. |
42
42
|`AllPages`|`bool`| Whether to export the current page only, or the entire data from the data source. |
43
43
44
+
> Before enabling the export feature, ensure you are familiar with [its specifics](slug:grid-export-overview#how-it-works).
45
+
44
46
>caption Export the Grid to Excel - Example
45
47
46
48
````RAZOR
@@ -99,6 +101,11 @@ Optionally, you can also set the `GridExcelExport` tag settings under the `GridE
99
101
}
100
102
````
101
103
104
+
105
+
## Requirements
106
+
107
+
* If you are setting `Width` to the columns, use only `px`. Excel does not understand units different than `px` 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.
108
+
102
109
## Programmatic Export
103
110
104
111
You can programmatically invoke the export feature of the Grid, by using the following methods exposed on the `@ref` of the Grid:
@@ -199,16 +206,6 @@ For more advanced customization (such as coloring the headers or bolding the tit
199
206
200
207
Read more about how to [customize the exported file](slug:grid-export-events).
201
208
202
-
## Notes
203
-
204
-
The Excel export has the following specifics:
205
-
206
-
* 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.
207
-
* 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 <ahref="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).
* 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.
25
+
26
+
## Requirements
27
+
28
+
* 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:
29
+
30
+
````C#.skip-repl
31
+
services.AddServerSideBlazor().AddHubOptions(o =>
32
+
{
33
+
o.MaximumReceiveMessageSize = 1024 * 1024; // 1MB
34
+
});
35
+
````
36
+
37
+
## Limitations
38
+
39
+
* 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 PDF file. Find a <ahref="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).
40
+
41
+
*`bool` fields are exported as `TRUE` or `FALSE` strings, because there is no native boolean data type in exported format and these string values are the most common ones used in data and macros.
42
+
43
+
* Date and number formats are exported with 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).
44
+
45
+
* The Grid exports only `<GridColumn>` instances. Other types of columns are not exported, for example command, checkbox, hierarchy, group and row-drag columns.
46
+
47
+
## Customization
48
+
49
+
The Grid allows customizing 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)
Copy file name to clipboardExpand all lines: components/grid/export/pdf.md
+20-16Lines changed: 20 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ description: Export to PDF the Grid for Blazor.
5
5
slug: grid-export-pdf
6
6
tags: telerik,blazor,grid,export,pdf
7
7
published: True
8
-
position: 1
8
+
position: 7
9
9
---
10
10
11
11
# Grid PDF Export
@@ -17,9 +17,11 @@ When you click the Export button, your browser will receive the resulting file.
17
17
#### In This Article
18
18
19
19
-[Basics](#basics)
20
+
-[How It Works](#how-it-works)
21
+
-[Requirements](#requirements)
22
+
-[Limitations](#limitations)
20
23
-[Programmatic Export](#programmatic-export)
21
24
-[Customization](#customization)
22
-
-[Notes](#notes)
23
25
-[Custom Export](#custom-export)
24
26
25
27
## Basics
@@ -43,6 +45,8 @@ Optionally, you can also set the `GridPdfExport` tag settings under the `GridExp
43
45
|`PaperSize`|`GridPdfExportPaperSize` enum <br/> (`A4`) | The size of the paper for the exported file. |
44
46
|`PageOrientation`|`GridPdfExportPageOrientation` enum <br/> (`Portrait`)| The orientation of the page—portrait or landscape. |
45
47
48
+
> Before enabling the export feature, ensure you are familiar with [its specifics](slug:grid-export-overview#how-it-works).
49
+
46
50
>caption Export the Grid to PDF
47
51
48
52
````RAZOR
@@ -103,6 +107,20 @@ Optionally, you can also set the `GridPdfExport` tag settings under the `GridExp
103
107
}
104
108
````
105
109
110
+
## How It Works
111
+
112
+
* For performance reasons, the PDF export mechanism draws each cell value on a single line. Any content that does not fit in the available space will be clipped. Text wrapping and PDF column resizing is not supported.
113
+
* Exporting to PDF in UI for Blazor is different from exporting in Kendo jQuery, where the full HTML is exported. The Blazor export to PDF will export the Grid to a table, similar to an Excel table. If you want [to export to PDF as HTML, you can use a custom approach](#custom-export).
114
+
115
+
## Requirements
116
+
117
+
* PDF export requires pixel widths for all columns. Widths in other units such as `%` or `em` cannot be translated correctly and the respective columns will collapse in the exported PDF file. The column widths for the PDF export can differ from the ones in the Grid configuration for the web browser. To set column widths for the PDF file only, use the `Width` property of the [`OnBeforeExportEventArgs.Columns`](slug:grid-export-events#for-pdf-export) members.
118
+
* Provide appropriate `PaperSize` and `PageOrientation` properties. For example, if you want to render 20 columns (100px each) in an A4 sheet, then this will yield unexpected results. The column dimensions in a PDF file are fixed, thus they cannot be resized as in Excel, which requires the developer to ensure proper export dimensions.
119
+
120
+
## Limitations
121
+
122
+
* Some PDF fonts do not include Cyrillic or other non-Latin characters. In such cases, [load a compatible font explicitly](https://docs.telerik.com/devtools/document-processing/knowledge-base/pdfprocessing-implement-fontsprovider).
123
+
106
124
## Programmatic Export
107
125
108
126
You can programmatically invoke the export feature of the Grid, by using the following methods exposed on the `@ref` of the Grid:
@@ -200,20 +218,6 @@ For more advanced customization the Grid lets you get the `MemoryStream` of the
200
218
201
219
Read more about how to [customize the exported file](slug:grid-export-events).
202
220
203
-
## Notes
204
-
205
-
The PDF export has the following specifics:
206
-
207
-
* PDF export requires pixel widths for all columns. Widths in other units such as `%` or `em` cannot be translated correctly and the respective columns will collapse in the exported PDF file. The column widths for the PDF export can differ from the ones in the Grid configuration for the web browser. To set column widths for the PDF file only, use the `Width` property of the [`OnBeforeExportEventArgs.Columns`](slug:grid-export-events#for-pdf-export) members.
208
-
* For performance reasons, the PDF export mechanism draws each cell value on a single line. Any content that does not fit in the available space will be clipped. Text wrapping and PDF column resizing is not supported.
209
-
* Provide appropriate `PaperSize` and `PageOrientation` properties. For example, if you want to render 20 columns (100px each) in an A4 sheet, then this will yield unexpected results. The column dimensions in a PDF file are fixed, thus they cannot be resized as in Excel, which requires the developer to ensure proper export dimensions.
210
-
* Exporting to PDF in UI for Blazor is different from exporting in Kendo jQuery, where the full HTML is exported. The Blazor export to PDF will export the Grid to a table, similar to an Excel table. If you want [to export to PDF as HTML, you can use a custom approach](#custom-export).
211
-
* Some PDF fonts do not include Cyrillic or other non-Latin characters. In such cases, [load a compatible font explicitly](https://docs.telerik.com/devtools/document-processing/knowledge-base/pdfprocessing-implement-fontsprovider).
212
-
* 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 PDF file. Find a <ahref="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).
0 commit comments