RadGrid can export the data to Microsoft Excel/Microsoft Word format.
This can be done via the client-side or server-side methods (respectively of the
client-side RadGridTable object or server-side MasterTableView object):
- server-side
o ExportToExcel()
o ExportToWord()
- client-side
o ExportToExcel(fileName)
o ExportToWord(fileName)
where
fileName is a string specifying the name of the file that will be created.
The exporting feature is unified to make the resulting content MS Office 2003 and MS Office 2007 compatible.
Moreover, you can export the grid data in CSV format with the ExportToCSV() method.
You can configure the exporting settings for the grid through the
RadGrid.ExportSettings
section. The available choices are:
- FileName - a string specifying the name (without the extension) of the file that
will be created. The file extension is automatically added based on the method that is used
- ExportOnlyData - determines whether only data will be exported
- IgnorePaging - specifies whether all records will be exported or merely those on the current page
- OpenInNewWindow - opens the exported grid in a new instead of the same page
- Excel.Format - this option gives you the freedom to choose native export to Excel (Telerik.Web.UI.GridExcelExportFormat.ExcelML)
or not. Thus you can customize the look and feel of the grid table intercepting events prior to the rendering of
the export document. Note that this feature works with ExportOnlyData set to true, otherwise the default export
mechanism will be executed.
Additional exporting tips and tricks you can learn from the Telerik RadGrid export chapter
in the grid documentation:
Controls - RadGrid - Exporting