aspnetmvc-devexpress-dot-web-dot-mvc-dot-mvcxpivotgridexportsettings-df198b60.md
Enables you to render a different content for individual field values, if the PivotGrid is exported in the WYSIWYG mode.
Namespace : DevExpress.Web.Mvc
Assembly : DevExpress.Web.Mvc5.v25.2.dll
NuGet Package : DevExpress.Web.Mvc5
public EventHandler<WebCustomExportFieldValueEventArgs> CustomExportFieldValue { get; set; }
Public Property CustomExportFieldValue As EventHandler(Of WebCustomExportFieldValueEventArgs)
| Type | Description |
|---|---|
| EventHandler<WebCustomExportFieldValueEventArgs> |
A delegate method allowing you to implement custom processing.
|
You can access this nested property as listed below:
| Object Type | Path to CustomExportFieldValue |
|---|---|
| PivotGridSettings |
.SettingsExport .CustomExportFieldValue
|
The CustomExportFieldValue event occurs for each field value when the PivotGrid is being exported in WYSIWYG mode, exported to PDF or printed. You can handle this event to change the field value’s appearance and contents in a printed document.
Note
The complete sample project How to obtain the appointment, resource or time interval selected by an end-user is available in the DevExpress Examples repository.
settings.SettingsExport.CustomExportFieldValue = (sender, e) =>
{
if (e.Field != null)
{
if (e.Field.FieldName == "ProductName")
{
e.Brick.Url = String.Format("https://www.google.com/search?q={0}", e.Text);
((DevExpress.XtraPrinting.TextBrick)e.Brick).Target = "_blank";
}
if (e.Field.FieldName == "Country" && e.Text == "USA")
{
DevExpress.XtraPrinting.ImageBrick imBrick = new DevExpress.XtraPrinting.ImageBrick();
imBrick.Image = Image.FromFile(HttpContext.Current.Server.MapPath("~/Content/us.png"));
imBrick.SizeMode = DevExpress.XtraPrinting.ImageSizeMode.AutoSize;
e.Brick = imBrick;
}
}
};
settings_PivotGrid.SettingsExport.CustomExportFieldValue =
Sub(sender, e)
If e.Field IsNot Nothing Then
If e.Field.FieldName = "ProductName" Then
e.Brick.Url = String.Format("https://www.google.com/search?q={0}", e.Text)
CType(e.Brick, DevExpress.XtraPrinting.TextBrick).Target = "_blank"
End If
If e.Field.FieldName = "Country" AndAlso e.Text = "USA" Then
Dim imBrick As New DevExpress.XtraPrinting.ImageBrick()
imBrick.Image = Image.FromFile(HttpContext.Current.Server.MapPath("~/Content/us.png"))
imBrick.SizeMode = DevExpress.XtraPrinting.ImageSizeMode.AutoSize
e.Brick = imBrick
End If
End If
End Sub
Tip
The CustomExportFieldValue and MVCxPivotGridExportSettings.CustomExportCell events are not in effect during the export in Data-Aware mode. To customize cells in Data-Aware export mode, use the PivotXlsExportOptions.CustomizeCell and PivotXlsxExportOptions.CustomizeCell events.
See Also
Declaring Server-Side Event Handlers
MVCxPivotGridExportSettings Class