Skip to main content

XlsxExportOptionsEx.BeforeExportRow Event

In This Article

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.v24.2.Core.dll

NuGet Package: DevExpress.Printing.Core

#Declaration

public event BeforeExportRowEventHandler BeforeExportRow

#Remarks

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;
    }
}
See Also