corelibraries-devexpress-dot-xtraprinting-dot-xlsexportoptionsex-139e2006.md
Fires consecutively for each control row when this row is about to be exported. Allows you to skip specific rows if they do not meet your custom criteria.
Namespace : DevExpress.XtraPrinting
Assembly : DevExpress.Printing.v25.2.Core.dll
NuGet Package : DevExpress.Printing.Core
public event BeforeExportRowEventHandler BeforeExportRow
Public Event BeforeExportRow As BeforeExportRowEventHandler
The code below illustrates how to ignore blank rows when exporting Data Grid records.
void Options_BeforeExportRow(DevExpress.Export.ExportRowEventArgs ea) {
if(ea.DataSourceOwner is GridViewImplementer<ColumnImplementer, DataRowImplementer> viewImplementer) {
var data = viewImplementer.View.GetRow(ea.Row.LogicalPosition); // Row object in the data source.
if (data == null)
ea.Cancel = true;
}
}
Private Sub Options_BeforeExportRow(ByVal ea As DevExpress.Export.ExportRowEventArgs)
If TypeOf ea.DataSourceOwner Is GridViewImplementer(Of ColumnImplementer, DataRowImplementer) viewImplementer Then
Dim data = viewImplementer.View.GetRow(ea.Row.LogicalPosition) ' Row object in the data source.
If data Is Nothing Then
ea.Cancel = True
End If
End If
End Sub
See Also