RadGridView Export PDF Orientation Landscape

1 Answer 191 Views
GridView
Benedikt
Top achievements
Rank 3
Iron
Iron
Iron
Benedikt asked on 29 Nov 2021, 12:02 PM

Hi,

I'm currently exporting a RadGridView with the default ExportToPdf function:

            using (FileStream fs = new FileStream(tempPfadDateiPDF, FileMode.Create))
            {
                GridViewDocumentExportOptions options = new GridViewDocumentExportOptions()
                {
                    ShowColumnHeaders = true,
                    AutoFitColumnsWidth = true,
                };
                options.ExcludedColumns.Add(ucEndtermintreueDaten.rgvEndtermintreueDaten.Columns["Ausblenden"]);

                ucEndtermintreueDaten.rgvEndtermintreueDaten.ExportToPdf(fs, options);
            }

Some users requested to export in landscape orientation. Is this possible somehow?

 

Greetings

1 Answer, 1 is accepted

Sort by
1
Accepted
Dilyan Traykov
Telerik team
answered on 02 Dec 2021, 10:51 AM

Hi Benedikt,

When using the ExportToPdf method, you can provide an instance of the GridViewPdfExportOptions class (which inherits from GridViewDocumentExportOptions) and also specify the orientation of the exported page via the PageOrientation property:

                using (FileStream fs = new FileStream(tempPfadDateiPDF, FileMode.Create))
                {
                    GridViewPdfExportOptions options = new GridViewPdfExportOptions()
                    {
                        ShowColumnHeaders = true,
                        AutoFitColumnsWidth = true,
                        PageOrientation = Telerik.Windows.Documents.Model.PageOrientation.Landscape
                    };
                    options.ExcludedColumns.Add(ucEndtermintreueDaten.rgvEndtermintreueDaten.Columns["Ausblenden"]);

                    ucEndtermintreueDaten.rgvEndtermintreueDaten.ExportToPdf(fs, options);
                }

Can you please give this a try and let me know if it provides the desired result?

Regards,
Dilyan Traykov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Benedikt
Top achievements
Rank 3
Iron
Iron
Iron
commented on 02 Dec 2021, 11:58 AM

Hi Dilyan

 

Works like charm, thank you very much :) 

Tags
GridView
Asked by
Benedikt
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Dilyan Traykov
Telerik team
Share this question
or