wpf-devexpress-dot-xpf-dot-pivotgrid-dot-pivotgridcsvexportoptions.md
Allows you to substitute a cell value in the output 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 code snippet shows how to export data from a PivotGrid Control to CSV format. The PivotGridCsvExportOptions.CustomizeCell event is used to format the numbers in the exported cells as thousands.
//...
private void Options_CustomizeCell(CustomizePivotCellEventArgs e) {
if (e.ExportArea == PivotGridExportArea.Data && e.CellItemInfo.Value != null)
{
e.Value = string.Format("${0:0,}K", Convert.ToDecimal(e.CellItemInfo.Value));
e.Handled = true;
}
}
void Button_Click(object sender, RoutedEventArgs e) {
PivotGridCsvExportOptions op = new PivotGridCsvExportOptions();
op.Encoding = Encoding.Unicode;
op.Separator = CultureInfo.CurrentCulture.TextInfo.ListSeparator.ToString();
op.CustomizeCell += Options_CustomizeCell;
pivorGrid1.ExportToCsv(file, op);
}
'...
Private Sub Options_CustomizeCell(ByVal e As CustomizePivotCellEventArgs)
If e.ExportArea = PivotGridExportArea.Data AndAlso e.CellItemInfo.Value IsNot Nothing Then
e.Value = String.Format("${0:0,}K", Convert.ToDecimal(e.CellItemInfo.Value))
e.Handled = True
End If
End Sub
Private Sub Button_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim op As New PivotGridCsvExportOptions()
op.Encoding = Encoding.Unicode
op.Separator = CultureInfo.CurrentCulture.TextInfo.ListSeparator.ToString()
AddHandler op.CustomizeCell, AddressOf Options_CustomizeCell
pivorGrid1.ExportToCsv(file, op)
End Sub
See Also
PivotGridCsvExportOptions Class