New to Telerik UI for WPF? Start a free 30-day trial
Exporting Custom Column
Updated on Sep 24, 2025
As of R1 2018 the GetCellContent method is no longer used for exporting a custom column content. Instead, the GetExportCellContent one of GridViewBoundColumnBase needs to be overriden. Check Example 2.
In order to automatically export a custom column, without handling some of the exporting events, it should implement the IExportableColumn interface. The interface exposes the following methods and properties:
- GetCellContent: Gets the content of the cell. You can override it to return custom value.
- DataFormatString: Gets or sets the string format applied to the column.
- ExportedElementWidth: Gets the actual width of the column.
The GridViewBoundColumnBase class implements the interface so you can directly override the method.
[C#]Example 1: Overriden GetCellContent method
C#
protected override object GetCellContent(object item)
{
var columnProperty = item.GetType().GetProperty(this.DataMemberBinding.Path.Path);
return string.Format("@ {0} @", columnProperty.GetValue(item, null) as string);
}
[C#]Example 2: Overriden GetExportCellContent method
C#
protected override object GetExportCellContent(object item)
{
var columnProperty = item.GetType().GetProperty(this.DataMemberBinding.Path.Path);
return string.Format("@ {0} @", columnProperty.GetValue(item, null) as string);
}
The values from the exported column will appear in Excel as shown in Figure 1.
Figure 1: Exported Custom Column to Excel
