Skip to content

Commit 1f63941

Browse files
committed
chore(grid): updated export articles
1 parent 2b4708b commit 1f63941

File tree

4 files changed

+36
-15
lines changed

4 files changed

+36
-15
lines changed

components/grid/export/csv.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ Optionally, you can also set the `GridCsvExport` tag settings under the `GridExp
9999

100100
You can programmatically invoke the export feature of the Grid, by using the following methods exposed on the `@ref` of the Grid:
101101

102-
* `SaveAsCsvFileAsync` - `ValueTask` - sends the exported CSV file to the browser for download
103-
* `ExportToCsvAsync` - `Task<MemoryStream>` - returns the exported data as a `MemoryStream`. The stream itself is finalized, so that the resource does not leak. To read and work with the stream, clone its available binary data to a new `MemoryStream` instance.
102+
| Method | Type | Description |
103+
| --- | --- | --- |
104+
| `SaveAsCsvFileAsync` | `ValueTask` | sends the exported CSV file to the browser for download. |
105+
| `ExportToCsvAsync` | `Task<MemoryStream>` | returns the exported data as a `MemoryStream`. The stream itself is finalized, so that the resource does not leak. To read and work with the stream, clone its available binary data to a new `MemoryStream` instance. |
104106

105107
>note The same methods are exposed for exporting an [Excel file]({%slug grid-export-excel%}#programmatic-export).
106108

components/grid/export/events.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ You can customize the files exported to Excel and CSV by using the [OnBeforeExpo
1717
- [OnBeforeExport](#onbeforeexport)
1818
- [For Excel Export](#for-excel-export)
1919
- [For CSV Export](#for-csv-export)
20+
- [For PDF Export](#for-pdf-export)
2021
- [OnAfterExport](#onafterexport)
2122
- [For Excel Export](#for-excel-export-1)
2223
- [For CSV Export](#for-csv-export-1)
24+
- [For PDF Export](#for-pdf-export)
2325

2426
## OnBeforeExport
2527

@@ -251,6 +253,10 @@ To export a hidden Grid column that has its `Visible` parameter set to `false`,
251253
}
252254
````
253255

256+
### For Pdf Export
257+
258+
xzxz
259+
254260
## OnAfterExport
255261

256262
The `OnAfterExport` event fires after [OnBeforeExport](#onbeforeexport) and before the generated file is provided to the user. You can use the event to make changes to the exported file. The event handler receives a `GridAfterExcelExportEventArgs` or `GridAfterCsvExportEventArgs` object, depending on the type of export, which provides the following fields:
@@ -405,6 +411,9 @@ The `OnAfterExport` event fires after [OnBeforeExport](#onbeforeexport) and befo
405411
}
406412
````
407413

414+
### For Pdf Export
415+
416+
xzxz
408417

409418
## See Also
410419

components/grid/export/excel.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ Optionally, you can also set the `GridExcelExport` tag settings under the `GridE
9999

100100
You can programmatically invoke the export feature of the Grid, by using the following methods exposed on the `@ref` of the Grid:
101101

102-
* `SaveAsExcelFileAsync` - `ValueTask` - sends the exported excel file to the browser for download.
103-
* `ExportToExcelAsync` - `Task<MemoryStream>` - returns the exported data as a `MemoryStream`. The stream itself is finalized, so that the resource does not leak. To read and work with the stream, clone its available binary data to a new `MemoryStream` instance.
102+
| Method | Type | Description |
103+
| --- | --- | --- |
104+
| `SaveAsExcelFileAsync` | `ValueTask` | sends the exported excel file to the browser for download. |
105+
| `ExportToExcelAsync` | `Task<MemoryStream>` | returns the exported data as a `MemoryStream`. The stream itself is finalized, so that the resource does not leak. To read and work with the stream, clone its available binary data to a new `MemoryStream` instance. |
104106

105107
>note The same methods are exposed for exporting a [CSV file]({%slug grid-export-csv%}#programmatic-export).
106108

components/grid/export/pdf.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,24 @@ When you click the Export button, your browser will receive the resulting file.
2525

2626
## Basics
2727

28-
To enable the Grid Pdf Export, add a [command button]({%slug components/grid/columns/command%}) with the `PdfExport` command name to the [Grid toolbar]({%slug components/grid/features/toolbar%}).
28+
To enable the Grid Pdf Export, add a [command button](slug:components/grid/columns/command) with the `PdfExport` command name to the [Grid toolbar](slug:components/grid/features/toolbar).
2929

3030
````RAZOR.skip-repl
3131
<GridToolBarTemplate>
3232
<GridCommandButton Command="PdfExport" Icon="@SvgIcon.FilePdf">Export to Pdf</GridCommandButton>
3333
</GridToolBarTemplate>
3434
````
3535

36-
Optionally, you can also set the `GridPdfExport` tag settings under the `GridExport` tag to subscribe to [Grid export events]({%slug grid-export-events%}) that allow further customizations of the exported columns/data or configure the Pdf export options:
36+
Optionally, you can also set the `GridPdfExport` tag settings under the `GridExport` tag to subscribe to [Grid export events](slug:grid-export-events) that allow further customizations of the exported columns/data or configure the Pdf export options:
3737

3838
@[template](/_contentTemplates/common/parameters-table-styles.md#table-layout)
3939

4040
| Parameter | Type and Default&nbsp;Value | Description |
4141
| --- | --- | --- |
4242
| `FileName` | `string` | the name of the file. The grid will add the `.xslx` extension for you. |
4343
| `AllPages` | `bool` | whether to export the current page only, or the entire data from the data source. |
44-
| `PaperSize` | `GridPdfExportPaperSize` enum | The size of the paper for the xported file. |
45-
| `PageOrientation` | `GridPdfExportPageOrientation` enum| The orientation of the page - portrait and landscape. |
44+
| `PaperSize` | `GridPdfExportPaperSize` enum <br/> (`A4`) | The size of the paper for the xported file. |
45+
| `PageOrientation` | `GridPdfExportPageOrientation` enum <br/> (`Portrait`)| The orientation of the page - portrait and landscape. |
4646

4747
>caption Export the Grid to Pdf - Example
4848
@@ -105,8 +105,12 @@ Optionally, you can also set the `GridPdfExport` tag settings under the `GridExp
105105

106106
You can programmatically invoke the export feature of the Grid, by using the following methods exposed on the `@ref` of the Grid:
107107

108-
* `SaveAsPdfFileAsync` - `ValueTask` - sends the exported Pdf file to the browser for download.
109-
* `ExportToPdfAsync` - `Task<MemoryStream>` - returns the exported data as a `MemoryStream`. The stream itself is finalized, so that the resource does not leak. To read and work with the stream, clone its available binary data to a new `MemoryStream` instance.
108+
@[template](/_contentTemplates/common/parameters-table-styles.md#table-layout)
109+
110+
| Method | Type | Description |
111+
| --- | --- | --- |
112+
| `SaveAsPdfFileAsync` | `ValueTask` | sends the exported Pdf file to the browser for download. |
113+
| `ExportToPdfAsync` | `Task<MemoryStream>` | returns the exported data as a `MemoryStream`. The stream itself is finalized, so that the resource does not leak. To read and work with the stream, clone its available binary data to a new `MemoryStream` instance. |
110114

111115
>caption Invoke the export function from code
112116
@@ -192,23 +196,27 @@ To customize the exported file, handle the `OnBeforeExport` or `OnAfterExport` e
192196

193197
The component allows you to control the data set that will be exported. It also provides built-in customization options for the columns such as `Width`, `Title` and more.
194198

195-
For more advanced customization (such as coloring the headers or bolding the titles) the Grid lets you get the `MemoryStream` of the file. Thus, you can customize it using the [`SpreadProcessing`](https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/overview) or the [`SpreadStreamProcessing`](https://docs.telerik.com/devtools/document-processing/libraries/radspreadstreamprocessing/overview) libraries that are available with your license. Find examples on how to [format the cells of the exported Pdf file with RadSpreadProcessing]({%slug grid-kb-custom-cell-formatting-with-radspreadprocessing%}) and how to [format the cells of the exported Pdf file with RadSpreadStreamProcessing]({%slug grid-kb-custom-cell-formatting-with-radspreadstreamprocessing%}).
199+
For more advanced customization (such as coloring the headers or bolding the titles) the Grid lets you get the `MemoryStream` of the file. Thus, you can customize it using the [`SpreadProcessing`](https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/overview) or the [`SpreadStreamProcessing`](https://docs.telerik.com/devtools/document-processing/libraries/radspreadstreamprocessing/overview) libraries that are available with your license. Find examples on how to [format the cells of the exported Pdf file with RadSpreadProcessing](slug:grid-kb-custom-cell-formatting-with-radspreadprocessing) and how to [format the cells of the exported Pdf file with RadSpreadStreamProcessing](slug: grid-kb-custom-cell-formatting-with-radspreadstreamprocessing).
196200

197-
Read more about how to [customize the exported file]({%slug grid-export-events%}).
201+
Read more about how to [customize the exported file](slug:grid-export-events).
198202

199203
## Notes
200204

201205
The Pdf export has the following specifics:
202206

207+
* When exporting grid columns, the developer must provide column widths that are appropriate for exporting the data. While an Excel file allows resizing its columns, the PDF file format does not allow resizing the columns. The width of the column can be changed from the `OnBeforeExportEventArgs.Columns[0].Width property`, so developers have full control over this value (note that it can be different from the one defined in the corresponding grid column, thus ensuring flexibility to render the grid columns with one widths and export them in others).
208+
* We do not recommend exporting columns without widths - while Excel has a default width for a column, PDF requires fixed dimensions. We recommend setting specific widths to all columns when exporting (note that this is unrelated to the width of the column of the grid as the export width can be configured in `OnBeforeExportEventArgs.Columns[0].Width` property.
203209
* Pdf 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.
204-
* 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 <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-Pdf%}).
210+
* When exporting grid columns, the developer must provide appropriate `PaperSize` and `PageOrientation` properties. For example, if you want to render 20 columns (100px each) in a 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.
211+
* 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).
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 <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-Pdf).
205213

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

208216

209217
## Custom Export
210218

211-
The [Telerik Document Processing tools]({%slug dpl-in-blazor%}) that come with your Blazor license let you generate a PDF file based on the data in the grid.
219+
The [Telerik Document Processing tools](slug:dpl-in-blazor) that come with your Blazor license let you generate a PDF file based on the data in the grid.
212220

213221
The following sample projects show two ways to implement a PDF export
214222

@@ -221,5 +229,5 @@ You can also follow the feature request for <a href="https://feedback.telerik.co
221229

222230
## See Also
223231

224-
* [Blazor Grid]({%slug grid-overview%})
232+
* [Blazor Grid](slug:grid-overview)
225233
* [Live Demo: Grid Pdf Export](https://demos.telerik.com/blazor-ui/grid/export-Pdf)

0 commit comments

Comments
 (0)