Xceed DataGrid for WPF v7.2 Documentation
Changing the Group-Header Formats

The following example demonstrates how to change the text that is displayed in the group headers when they are exported to Excel.

XAML
Copy Code
<Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid">
  <Grid.Resources>
     <xcdg:DataGridCollectionViewSource x:Key="cvs_orders"
                                        Source="{Binding Source={x:Static Application.Current}, Path=Orders}">
        <xcdg:DataGridCollectionViewSource.GroupDescriptions>
           <xcdg:DataGridGroupDescription PropertyName="ShipCountry" />
        </xcdg:DataGridCollectionViewSource.GroupDescriptions>
     </xcdg:DataGridCollectionViewSource>
  </Grid.Resources>
  <DockPanel>
     <Button Content="Export"
             Click="ExportButton_Click"
             DockPanel.Dock="Top" />
     <xcdg:DataGridControl x:Name="OrdersGrid"
                           ItemsSource="{Binding Source={StaticResource cvs_orders}}"/>
  </DockPanel>
</Grid>
VB.NET
Copy Code
Private Sub ExportButton_Click( ByVal sender As Object, ByVal e As RoutedEventArgs )
  Dim exporter As New ExcelExporter( Me.OrdersGrid )
  exporter.GroupHeaderFormat.MultipleItemsFormat = "The {1} group contains {2} items."
  exporter.GroupHeaderFormat.SingleItemFormat = "The {1} group contains 1 item."
  exporter.Export( "d:\orders.xls" )
End Sub
C#
Copy Code
private void ExportButton_Click( object sender, RoutedEventArgs e )
{
 ExcelExporter exporter = new ExcelExporter( this.OrdersGrid );
 exporter.GroupHeaderFormat.Plural = "The {1} group contains {2} items.";
 exporter.GroupHeaderFormat.Single = "The {1} group contains 1 item.";     
 exporter.Export( "d:\\orders.xls" );
}