BlazorExportController.CustomizeGridExport Event
Fires before the export operation.
Namespace: DevExpress.ExpressApp.Blazor.SystemModule
Assembly: DevExpress.ExpressApp.Blazor.v24.1.dll
NuGet Package: DevExpress.ExpressApp.Blazor
Declaration
Event Data
The CustomizeGridExport event's data class is GridExportEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
ExportTarget | Returns the target format of the exported document. |
Handled | Gets or sets a value that indicates whether the event handler has completely handled the event or whether the system should continue its own processing. Inherited from HandledEventArgs. |
Options | Returns an object that specifies export options. |
Remarks
The CustomizeGridExport
event occurs before export. The handler’s Options parameter allows you to customize export options. To obtain the target format of the resulting file, use the handler’s ExportTarget parameter.
The code below demonstrates how to implement a Controller in a Blazor module to use a GridXlExportOptions export option:
using DevExpress.Blazor;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Blazor.SystemModule;
using DevExpress.ExpressApp.SystemModule;
// ...
public partial class CustomizeExportControllerBlazor : ViewController {
public CustomizeExportControllerBlazor() {
InitializeComponent();
TargetViewType = ViewType.ListView;
}
private BlazorExportController blazorExportController;
protected override void OnActivated() {
base.OnActivated();
blazorExportController = Frame.GetController<BlazorExportController>();
// Subscribe to CustomizeGridExport event
blazorExportController.CustomizeGridExport += blazorExportController_CustomizeGridExport;
}
void blazorExportController_CustomizeGridExport(object sender, GridExportEventArgs e) {
// Export only selected rows
if(e.Options is GridXlExportOptions options) {
options.ExportSelectedRowsOnly = true;
}
}
protected override void OnDeactivated() {
blazorExportController.CustomizeGridExport -= blazorExportController_CustomizeGridExport;
base.OnDeactivated();
}
}