The purpose of the events is to provide you with a mechanism to style or modify the exported data.

When you call the Export method of RadGridView the ElementExporting and ElementExported events are fired.

If you are using the more recently introduced ExportToXlsx and ExportToPdf methods, you should take advantage of the ElementExportingToDocument and ElementExportedToDocument events.

The ElementExporting and ElementExportingToDocument events can be cancelled for a particular row or cell. If they are not cancelled - the ElementExported or ElementExportedToDocument event is fired for the associated RadGridView.

You can subscribe to the events either declaratively or from the code-behind like this:

The event was introcuded in Q1 2010 SP2 as a direct replacement of the obsolete Exporting event.
The event takes argument of type GridViewElementExportingEventArgs which expose the following properties:

Cancel: Gets or sets a boolean value that indicates whether the event should be canceled or not.

Context: Gets the data context of the element that is about to be exported. In case the element is Cell the DataContext would be the underlying item.

Element: Gets the current element that is about to be exported.

Format: Gets the current export format - ExcelMl, Html, etc.

Value: Gets or sets the value that is about to be exported. You can use it to change a certain element`s value.

ShouldEncodeValue: Gets or sets a value indicating whether special characters in the cell value will be escaped.

The event argument`s property Element identifies the currently exported element. The possible element types are defined in the ExportElement enumeration:

Cell

GroupHeaderCell

GroupHeaderRow

GroupHeaderRow

HeaderRow

Row

Table

You can use it in combination with the Cancel property to omit the export of a certain element.

As of version Q1 2015 we have removed the obsolete class GridViewExportEventArgs and TextAlignment, VerticalAlignment, Background, Foreground, FontFamily, FontSize, FontWeight, Width, Height, Styles, Attributes properties from GridViewElementExportingEventArgs class. You can find detailed instructions on how to migrate your existing code related to styling in the Backward Compatibility article.

The event is fired when exporting with ExportToXlsx or ExportToPdf methods.
The event handler expects GridViewElementExportingToDocumentEventArgs argument that has the following properties:

Element - Gets the current element that is about to be exported.

Cancel - Gets or sets a boolean value that indicates whether the event should be canceled or not.

DataContext - the DataContext of the corresponding visual element. For example the DataContext of a row is its corresponding data item.

Value - the value that is about to be exported.

VisualParameters - they are of type GridViewDocumentVisualExportParameters and have a property Style which is of type CellSelectionStyle. It provides the ability to set the FontSize, Fill and etc. for the exported document.