wpf-devexpress-dot-xpf-dot-pivotgrid-dot-pivotgridxlsxexportoptions.md
Allows you to customize a PivotGrid’s cell in the exported XLSX document. Only available in data-aware export mode.
Namespace : DevExpress.Xpf.PivotGrid
Assembly : DevExpress.Xpf.PivotGrid.v25.2.dll
NuGet Package : DevExpress.Wpf.PivotGrid
public event CustomizePivotCellEventHandler CustomizeCell
Public Event CustomizeCell As CustomizePivotCellEventHandler
Follow the steps below to customize data in the output document.
The following example exports data from a PivotGrid Control to Xlsx format. The PivotGridXlsxExportOptions.CustomizeCell event is used to change the background color of the “Category Name” column in the output document.
//...
void op_CustomizeCell(CustomizePivotCellEventArgs e){
if (e.ValueItemInfo != null && e.ValueItemInfo.Field == fieldCategoryName)
{
e.Formatting.BackColor = Color.AliceBlue;
e.Handled = true;
}
}
void Button_Click(object sender, RoutedEventArgs e) {
PivotGridXlsxExportOptions op = new PivotGridXlsxExportOptions();
op.CustomizeCell += op_CustomizeCell;
pivorGrid1.ExportToXlsx(file, op);
}
'...
Private Sub op_CustomizeCell(ByVal e As CustomizePivotCellEventArgs)
If e.ValueItemInfo IsNot Nothing AndAlso e.ValueItemInfo.Field = fieldCategoryName Then
e.Formatting.BackColor = Color.AliceBlue
e.Handled = True
End If
End Sub
Private Sub Button_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim op As New PivotGridXlsxExportOptions()
AddHandler op.CustomizeCell, AddressOf op_CustomizeCell
pivorGrid1.ExportToXlsx(file, op)
End Sub
See Also
PivotGridXlsxExportOptions Class