New to Telerik UI for WinUI? Start a free 30-day trial
Export to PDF
Updated on Mar 26, 2026
The export feature allows you to save the data from the DataGrid component to few different formats. This article shows how to save it to PDF.
Exporting the Document
The feature works with the Export and ExportAsync methods of RadDataGrid. The methods allow you to provide a stream (usually pointing to a file), a document format and export options objects.
Export DataGrid to PDF format
C#
string projectRootFolderPath = System.IO.Path.GetFullPath("../../../../../../", AppDomain.CurrentDomain.BaseDirectory);
using (var stream = File.Open(projectRootFolderPath + "\\" + "SampleDocument.pdf", FileMode.OpenOrCreate))
{
this.dataGrid.Export(stream, ExportFormat.Pdf);
}
To include additional settings for the document, use the DataGridExportOptions class. Read more about the available settings in the Modifying Exported Data article.
Using the DataGridExportOptions
C#
string projectRootFolderPath = System.IO.Path.GetFullPath("../../../../../../", AppDomain.CurrentDomain.BaseDirectory);
using (var stream = File.Open(projectRootFolderPath + "\\" + "SampleDocument.pdf", FileMode.OpenOrCreate))
{
this.dataGrid.Export(stream, ExportFormat.Pdf, new DataGridExportOptions()
{
AutoFitColumnsWidth = true,
ShowColumnFooters = true,
ShowColumnHeaders = false,
IgnoreCollapsedGroups = true
});
}
The exporting process can be customized at runtime using the
ElementExportingandElementExportedevents ofRadDataGrid. Read more in the Modifying Exported Data article.