Skip to content

Commit 0693df0

Browse files
committed
chore(grid): final updates
1 parent c4e5888 commit 0693df0

File tree

4 files changed

+48
-30
lines changed

4 files changed

+48
-30
lines changed

components/grid/export/csv.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@ To enable the grid CSV Export, add a [command button]({%slug components/grid/col
3232
</GridToolBarTemplate>
3333
````
3434

35-
Optionally, you can also set the `GridCsvExport` tag settings under the `GridExport` tag to choose:
35+
Optionally, you can also set the `GridCsvExport` tag settings under the `GridExport` tag to subscribe to the [Grid export events](slug:grid-export-events) that allow further customization of the exported columns/data or configure the CSV export options:
3636

37-
* `FileName` - the name of the file. The grid will add the `.csv` extension for you.
38-
* `AllPages` - whether to export the current page only, or the entire data from the data source.
39-
* Subscribe to [Grid export events]({%slug grid-export-events%}) that allow further customizations of the exported columns or data.
37+
@[template](/_contentTemplates/common/parameters-table-styles.md#table-layout)
38+
39+
| Parameter | Type and Default&nbsp;Value | Description |
40+
| --- | --- | --- |
41+
42+
| `FileName` | `string` | The name of the file. The grid will add the `.csv` extension for you. |
43+
| `AllPages` | `bool` | Whether to export the current page only, or the entire data from the data source. |
4044

4145
>caption Export the Grid to CSV - Example
4246
@@ -67,8 +71,9 @@ Optionally, you can also set the `GridCsvExport` tag settings under the `GridExp
6771
</TelerikGrid>
6872
6973
@code {
70-
List<SampleData> GridData { get; set; }
71-
bool ExportAllPages { get; set; }
74+
private List<SampleData> GridData { get; set; }
75+
76+
private bool ExportAllPages { get; set; }
7277
7378
protected override void OnInitialized()
7479
{
@@ -148,16 +153,17 @@ You can programmatically invoke the export feature of the Grid, by using the fol
148153
149154
private MemoryStream exportedCSVStream { get; set; }
150155
156+
private List<SampleData> GridData { get; set; }
157+
158+
private bool ExportAllPages { get; set; }
159+
151160
private async Task GetTheDataAsAStream()
152161
{
153162
MemoryStream finalizedStream = await GridRef.ExportToCsvAsync();
154163
155164
exportedCSVStream = new MemoryStream(finalizedStream.ToArray());
156165
}
157166
158-
List<SampleData> GridData { get; set; }
159-
bool ExportAllPages { get; set; }
160-
161167
protected override void OnInitialized()
162168
{
163169
GridData = Enumerable.Range(1, 100).Select(x => new SampleData

components/grid/export/events.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ You can customize the files exported to Excel and CSV by using the [OnBeforeExpo
2121
- [OnAfterExport](#onafterexport)
2222
- [For Excel Export](#for-excel-export-1)
2323
- [For CSV Export](#for-csv-export-1)
24-
- [For PDF Export](#for-pdf-export)
24+
- [For PDF Export](#for-pdf-export-1)
2525

2626
## OnBeforeExport
2727

@@ -258,14 +258,14 @@ To export a hidden Grid column that has its `Visible` parameter set to `false`,
258258
* `Columns` - `List<GridPdfExportColumn>` - a collection of all exportable columns in the Grid. These are all visible `GridColumn` instances. You can customize the following attributes of the Grid column before exporting it into PDF:
259259

260260
* `Width` - define the width of the column **in pixels**.
261-
* `Title` - define the column title to be shown in the Excel file header.
261+
* `Title` - define the column title to be shown in the PDF file header.
262262
* `NumberFormat` - provide an PDF-compatible number/date format
263263
* `Field` - set the data bound field of the column.
264264

265265
To export a hidden Grid column that has its `Visible` parameter set to `false`, you can manually define an instance of the `GridPdfExportColumn` in the handler for the `OnBeforeExport` event and add that column to the `args.Columns` collection.
266266

267267

268-
* `Data` - `IEnumerable<object>` - assign a custom collection of data to be exported to Excel, [for example only the selected items in the Grid]({%slug grid-kb-export-selected-rows%}).
268+
* `Data` - `IEnumerable<object>` - assign a custom collection of data to be exported to PDF, [for example only the selected items in the Grid]({%slug grid-kb-export-selected-rows%}).
269269

270270
* `isCancelled` - `bool` - cancel the `OnBeforeExcel` event by setting the `isCancelled` property to `true`.
271271

@@ -390,6 +390,8 @@ The `OnAfterExport` event fires after [OnBeforeExport](#onbeforeexport) and befo
390390

391391
* `Stream` - `MemoryStream` - The output of the Excel export as a memory stream. 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.
392392

393+
>caption Get the stream of the exported Excel file
394+
393395
````RAZOR Excel
394396
@* Get the output of the excel export as a memory stream *@
395397
@@ -465,6 +467,8 @@ The `OnAfterExport` event fires after [OnBeforeExport](#onbeforeexport) and befo
465467

466468
* `Stream` - `MemoryStream` - The output of the CSV export 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.
467469

470+
>caption Get the stream of the exported CSV file
471+
468472
````RAZOR CSV
469473
@* Get the output of the CSV export as a memory stream *@
470474
@@ -536,10 +540,12 @@ The `OnAfterExport` event fires after [OnBeforeExport](#onbeforeexport) and befo
536540
}
537541
````
538542

539-
### For Pdf Export
543+
### For PDF Export
540544

541545
* `Stream` - `MemoryStream` - The output of the PDF export as a memory stream. 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.
542546

547+
>caption Get the stream of the exported PDF file
548+
543549
````RAZOR
544550
@* Get the output of the PDF export as a MemoryStream *@
545551

components/grid/export/excel.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,14 @@ To enable the Grid Excel Export, add a [command button]({%slug components/grid/c
3232
</GridToolBarTemplate>
3333
````
3434

35-
Optionally, you can also set the `GridExcelExport` tag settings under the `GridExport` tag to choose:
35+
Optionally, you can also set the `GridExcelExport` tag settings under the `GridExport` tag to subscribe to the [Grid export events](slug:grid-export-events) that allow further customization of the exported columns/data or configure the Excel export options:
3636

37-
* `FileName` - the name of the file. The grid will add the `.xslx` extension for you.
38-
* `AllPages` - whether to export the current page only, or the entire data from the data source.
39-
* Subscribe to [Grid export events]({%slug grid-export-events%}) that allow further customizations of the exported columns or data.
37+
@[template](/_contentTemplates/common/parameters-table-styles.md#table-layout)
38+
39+
| Parameter | Type and Default&nbsp;Value | Description |
40+
| --- | --- | --- |
41+
| `FileName` | `string` | The name of the file. The grid will add the `.xslx` extension for you. |
42+
| `AllPages` | `bool` | Whether to export the current page only, or the entire data from the data source. |
4043

4144
>caption Export the Grid to Excel - Example
4245
@@ -67,8 +70,9 @@ Optionally, you can also set the `GridExcelExport` tag settings under the `GridE
6770
</TelerikGrid>
6871
6972
@code {
70-
List<SampleData> GridData { get; set; }
71-
bool ExportAllPages { get; set; }
73+
private List<SampleData> GridData { get; set; }
74+
75+
private bool ExportAllPages { get; set; }
7276
7377
protected override void OnInitialized()
7478
{
@@ -149,16 +153,17 @@ You can programmatically invoke the export feature of the Grid, by using the fol
149153
150154
private MemoryStream exportedExcelStream { get; set; }
151155
156+
private List<SampleData> GridData { get; set; }
157+
158+
private bool ExportAllPages { get; set; }
159+
152160
private async Task GetTheDataAsAStream()
153161
{
154162
MemoryStream finalizedStream = await GridRef.ExportToExcelAsync();
155163
156164
exportedExcelStream = new MemoryStream(finalizedStream.ToArray());
157165
}
158166
159-
List<SampleData> GridData { get; set; }
160-
bool ExportAllPages { get; set; }
161-
162167
protected override void OnInitialized()
163168
{
164169
GridData = Enumerable.Range(1, 100).Select(x => new SampleData

components/grid/export/pdf.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ To enable the Grid PDF Export, add a [command button](slug:components/grid/colum
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 customization 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 the [Grid export events](slug:grid-export-events) that allow further customization of the exported columns/data or configure the PDF export options:
3737

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

@@ -78,8 +78,9 @@ Optionally, you can also set the `GridPdfExport` tag settings under the `GridExp
7878
</TelerikGrid>
7979
8080
@code {
81-
List<SampleData> GridData { get; set; }
82-
bool ExportAllPages { get; set; }
81+
private List<SampleData> GridData { get; set; }
82+
83+
private bool ExportAllPages { get; set; }
8384
8485
protected override void OnInitialized()
8586
{
@@ -158,17 +159,17 @@ You can programmatically invoke the export feature of the Grid, by using the fol
158159
159160
private MemoryStream exportedPdfStream { get; set; }
160161
162+
private List<SampleData> GridData { get; set; }
163+
164+
private bool ExportAllPages { get; set; }
165+
161166
private async Task GetTheDataAsAStream()
162167
{
163168
MemoryStream finalizedStream = await GridRef.ExportToPdfAsync();
164169
165170
exportedPdfStream = new MemoryStream(finalizedStream.ToArray());
166171
}
167172
168-
private List<SampleData> GridData { get; set; }
169-
170-
private bool ExportAllPages { get; set; }
171-
172173
protected override void OnInitialized()
173174
{
174175
GridData = Enumerable.Range(1, 100).Select(x => new SampleData
@@ -198,7 +199,7 @@ To customize the exported file, handle the `OnBeforeExport` or `OnAfterExport` e
198199

199200
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.
200201

201-
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).
202+
For more advanced customization the Grid lets you get the `MemoryStream` of the file. Thus, you can customize it using the [`PdfProcessing`](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/overview) library that is available with your license.
202203

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

0 commit comments

Comments
 (0)