New to Telerik UI for WPF? Start a free 30-day trial
Get the Column of The Corresponding Cell
Updated on Sep 15, 2025
When a cell(header cell, cell, footer cell, group footer cells) is exported through the ExportToXlsx or ExportToPdf methods , the arguments of the ElementExportingToDocument event can be cast to GridViewCellExportingEventArgs. Thus, the column of the corresponding cell can be accessed.
The following example illustrates the approach: Example 3: Getting the Column of the Corresponding Cell
C#
this.gridViewExport.ElementExportingToDocument += (s, e) =>
{
if (e.Element == ExportElement.Cell)
{
var cellExportingArgs = e as GridViewCellExportingEventArgs;
if (cellExportingArgs.Column == this.gridViewExport.Columns[2])
{
(cellExportingArgs.VisualParameters as GridViewDocumentVisualExportParameters).Style = cellStyle;
}
}
};
[VB.NET] Example 3: Getting the Column of the Corresponding Cell
VB.NET
Me.gridViewExport.ElementExportingToDocument += Function(s, e)
If e.Element = ExportElement.Cell Then
Dim cellExportingArgs = TryCast(e, GridViewCellExportingEventArgs)
If cellExportingArgs.Column = Me.gridViewExport.Columns(2) Then
TryCast(cellExportingArgs.VisualParameters, GridViewDocumentVisualExportParameters).Style = cellStyle
End If
End If
End Function