Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

DataTableExporter.ProcessEmptyRow Event

Occurs when an empty row is encountered during export and the DataTableExportOptions.SkipEmptyRows property is false.

Namespace: DevExpress.Spreadsheet.Export

Assembly: DevExpress.Spreadsheet.v19.1.Core.dll

Declaration

public event ProcessEmptyRowEventHandler ProcessEmptyRow

Event Data

The ProcessEmptyRow event's data class is ProcessEmptyRowEventArgs. The following properties provide information specific to this event:

Property Description
Action Gets or sets an action to be performed when an empty row is encountered and the DataTableExporter.ProcessEmptyRow event occurs.
RowIndex Obtains the index of an empty row.

The event data class exposes the following methods:

Method Description
Initialize(Int32) Initializes the object before passing it to a DataTableExporter.ProcessEmptyRow event handler.

Remarks

The ProcessEmptyRow event enables you to specify the action performed when the exporter processes an empty row.

Example

using DevExpress.Spreadsheet;
using DevExpress.Spreadsheet.Export;
            Worksheet worksheet = spreadsheetControl1.Document.Worksheets.ActiveWorksheet;
            Range range = worksheet.Selection;
            // Determine whether the first row in a range contains headers.
            bool rangeHasHeaders = this.barCheckItemHasHeaders1.Checked;
            // Determine whether an empty row must stop conversion.
            bool stopOnEmptyRow = barCheckItemStopEmptyRow.Checked;

            // Create a data table with column names obtained from the first row in a range if it has headers.
            // Column data types are obtained from cell value types of cells in the first data row of the worksheet range.
            DataTable dataTable = worksheet.CreateDataTable(range, rangeHasHeaders);
            // Create the exporter that obtains data from the specified range, 
            // skips the header row (if required) and populates the previously created data table. 
            DataTableExporter exporter = worksheet.CreateDataTableExporter(range, dataTable, rangeHasHeaders);
            // Handle value conversion errors.
            exporter.CellValueConversionError += (sender,args)=> {args.Action = DataTableExporterAction.Continue;};
            if (stopOnEmptyRow) {
                exporter.Options.SkipEmptyRows = false;
                // Handle empty row.
                exporter.ProcessEmptyRow += (sender, args) => { args.Action = DataTableExporterAction.Stop; };
            }
            // Perform the export.
            exporter.Export();

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ProcessEmptyRow event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also