Edit this page

Export FAQ

For a general example on how to Export the data, you can check our Exporting WPF Demos.

  • How to export paged data:
  1. Save the PageSize and the PageIndex of RadDataPager

  2. Set the PageSize of RadDataPager to 0

  3. Export the data (you can use the (IEnumerable) dataPager.PagedSource as GridViewExportOptions.Items)

  4. Set the PageSize and the PageIndex back

You can download a runnable project from our online SDK repository here, the example is listed as GridView/ExportPagedDataExcel .

You can also check the SDK Samples Browser that provides a more convenient approach in exploring and executing the examples in the Telerik XAML SDK repository.

  • How to avoid error warning when exporting and 'xls' extension: The alert is a new security feature in Excel 2007 called Extension Hardening, which ensures that the file content being opened matches the extension type specified in the shell command that is attempting to open the file.
    In order to avoid getting this warning, you should export to ExcelML format with XML extension. You can also refer to this help article for an additional information.

  • Export with .xlsx extension: As of Q1 2015 a new method is introduced: ExportToXlsx. This exporting functionality is demonstrated in the Exporting to Xlsx and Pdf demo

  • Export with .pdf extension: As of Q1 2015 a new method is introduced: ExportToPdf. This exporting functionality is demonstrated in the Exporting to Xlsx and Pdf demo

  • Some columns are exported with a minimum Width: RadGridView exports the respective header cells with the minimum width value (which is 20 by default) if they have not been measured by the layout mechanism at the time the exporting operation takes place.To get all the columns exported with their actual width, you should first assure that they have been realized.As an alternative solution, if you do not have that much columns, you can set EnableColumnVirtualization="False" for RadGridView.

  • Do not export a particular column: You can subscribe for the ElementExporting event of RadGridView to control which columns will be exported. Once the event is raised, you can cancel the export (setting e.Cancel = true) when the Column of the currently exported element is a column you would like to skip.

  • How to export row details: You could export the data in row-details subscribing to the ElementExported event of main RadGridView to export additional rows based on the content in details. Please check the
    Exporting Row Details online demo for a further reference.

  • Modify the exported value: You could subscribe for the ElementExporting event of RadGridView and change the e.Value to be exported.

  • Export data on multiple worksheets of the same workbook: You can export data on different worksheets with RadSpreadProcessing, which model is completely independent from UI. You can also check our new example Export with RadSpreadProcessing on how to do so.

  • OutOfMemoryException: All the data to be exported is saved in memory, so the exporting capacities are not huge. For more complex scenarios, you consider using our Reporting tools built to suit various exporting scenarios.

You can also export data with RadSpreadProcessing, which model is completely independent from UI. You can check our new example Export with RadSpreadProcessing on how to do so.

Printing

How to print a document:

  • As of Q1 2015 RadGridView exposes a new method – ExportToPdf which allows exporting to Pdf format without the need to integrate RadGridView with RadSpreadProcessing.

  • Another way would be to follow the approach illustrated in the "Print and Print Preview" demo.

  • Another way would be to manually create the document to be exported.
    You can go through the articles about using the RadDocument and about the document viewer control - RadRichTextBox. You could as well review this article on how you could create the document elements.

  • You can also print data with RadSpreadProcessing, which model is completely independent from UI. You can check our new example Export with RadSpreadProcessing on how to do so.

In order to print or export with more advanced options you can check the Telerik Reporting product. You can find more information about it here.

See Also