Skip to content

Commit b7f8c3c

Browse files
ntachevaikoevskadimodi
authored
Document PDF export (#2706)
* docs(grid): document pdf export * chore(grid): updated export articles * chore(Grid): update pdf export article and examples * chore(grid): update export events * chore(grid): final updates * chore(grid): final * Update components/grid/export/csv.md Co-authored-by: Iva Stefanova Koevska-Atanasova <koevska@progress.com> * Update components/grid/export/csv.md Co-authored-by: Iva Stefanova Koevska-Atanasova <koevska@progress.com> * Update components/grid/export/events.md Co-authored-by: Iva Stefanova Koevska-Atanasova <koevska@progress.com> * Update components/grid/export/excel.md Co-authored-by: Iva Stefanova Koevska-Atanasova <koevska@progress.com> * Update components/grid/export/pdf.md Co-authored-by: Iva Stefanova Koevska-Atanasova <koevska@progress.com> * Update components/grid/export/pdf.md Co-authored-by: Iva Stefanova Koevska-Atanasova <koevska@progress.com> * Update components/grid/export/pdf.md Co-authored-by: Iva Stefanova Koevska-Atanasova <koevska@progress.com> * Update components/grid/export/excel.md Co-authored-by: Iva Stefanova Koevska-Atanasova <koevska@progress.com> * Update components/grid/export/pdf.md Co-authored-by: Iva Stefanova Koevska-Atanasova <koevska@progress.com> * Update components/grid/export/pdf.md Co-authored-by: Iva Stefanova Koevska-Atanasova <koevska@progress.com> * Update components/grid/export/pdf.md Co-authored-by: Iva Stefanova Koevska-Atanasova <koevska@progress.com> * Update components/grid/export/pdf.md Co-authored-by: Iva Stefanova Koevska-Atanasova <koevska@progress.com> * Update components/grid/export/pdf.md Co-authored-by: Iva Stefanova Koevska-Atanasova <koevska@progress.com> * Update components/grid/export/pdf.md Co-authored-by: Iva Stefanova Koevska-Atanasova <koevska@progress.com> * Update components/grid/export/pdf.md Co-authored-by: Iva Stefanova Koevska-Atanasova <koevska@progress.com> * Update components/grid/export/pdf.md Co-authored-by: Dimo Dimov <961014+dimodi@users.noreply.github.com> * chore(Grid): address feedback --------- Co-authored-by: Iva Stefanova Koevska-Atanasova <koevska@progress.com> Co-authored-by: Dimo Dimov <961014+dimodi@users.noreply.github.com>
1 parent 7d3c046 commit b7f8c3c

File tree

4 files changed

+504
-66
lines changed

4 files changed

+504
-66
lines changed

components/grid/export/csv.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ published: True
88
position: 1
99
---
1010

11-
# CSV Export
11+
# Grid CSV Export
1212

1313
You can export the grid to CSV with a click of a button. The current filter, sort, page, grouping and column order are applied to the `.csv` document.
1414

@@ -32,11 +32,14 @@ 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+
| `FileName` | `string` | The name of the file. The grid will add the `.csv` 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 CSV - Example
4245
@@ -67,8 +70,9 @@ Optionally, you can also set the `GridCsvExport` tag settings under the `GridExp
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
{
@@ -99,8 +103,10 @@ Optionally, you can also set the `GridCsvExport` tag settings under the `GridExp
99103

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

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.
106+
| Method | Type | Description |
107+
| --- | --- | --- |
108+
| `SaveAsCsvFileAsync` | `ValueTask` | Sends the exported CSV file to the browser for download. |
109+
| `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. |
104110

105111
>note The same methods are exposed for exporting an [Excel file](slug://grid-export-excel#programmatic-export).
106112
@@ -146,16 +152,17 @@ You can programmatically invoke the export feature of the Grid, by using the fol
146152
147153
private MemoryStream exportedCSVStream { get; set; }
148154
155+
private List<SampleData> GridData { get; set; }
156+
157+
private bool ExportAllPages { get; set; }
158+
149159
private async Task GetTheDataAsAStream()
150160
{
151161
MemoryStream finalizedStream = await GridRef.ExportToCsvAsync();
152162
153163
exportedCSVStream = new MemoryStream(finalizedStream.ToArray());
154164
}
155165
156-
List<SampleData> GridData { get; set; }
157-
bool ExportAllPages { get; set; }
158-
159166
protected override void OnInitialized()
160167
{
161168
GridData = Enumerable.Range(1, 100).Select(x => new SampleData

0 commit comments

Comments
 (0)