New to Telerik UI for WPF? Download free 30-day trial

Style Exported Html

You can use the ExportFormat.Html to export RadGridView in HTML format.

As of Q3 2013 GridViewElementExportingEventArgs exposes a new argument VisualParameters. The value of the property depends on the export format. Please note that it is only valid when exporting with ExportFormat.ExcelML and ExportFormat.Html.

Set Exported Element's VisualParameters

When using the ElementExporting event, the type of the VisualParameters property for this format is GridViewHtmlVisualExportParameters. It has the following properties:

  • Background
  • FontFamily
  • FontSize
  • FontWeight
  • Foreground
  • Height
  • TextAlignment
  • VerticalAlignment
  • Width

For example:

Example 1: Set the properties of the VisualParameters:

private void clubsGrid_ElementExporting_1(object sender, GridViewElementExportingEventArgs e) 
    if (e.VisualParameters is GridViewHtmlVisualExportParameters) 
        var param = e.VisualParameters as GridViewHtmlVisualExportParameters; 
        param.Background = Colors.Red; 
        param.FontFamily = new FontFamily("Verdana"); 
        param.FontSize = 30; 
        param.FontWeight = FontWeights.Bold; 
        param.Foreground = Colors.Green; 
        param.Height = 50; 
        param.TextAlignment = TextAlignment.Center; 
        param.VerticalAlignment = VerticalAlignment.Bottom; 
        param.Width = 500; 
You can read more about the export events here.

See Also

In this article