XlsExportOptionsEx.AfterAddRow Event

Fires immediately after a row is added to the output document.Only available in data-aware export mode.

Namespace: DevExpress.XtraPrinting

Assembly: DevExpress.Printing.v20.1.Core.dll

Declaration

public event AfterAddRowEventHandler AfterAddRow
Public Event AfterAddRow As AfterAddRowEventHandler

Remarks

The AfterAddRow event is raised each time a row from a source control is added to the output document. The event's DocumentRow parameter returns the index of the current row in the export output.

This event enables you to do the following:

  • Add a new row after the current row to the output document (AfterAddRowEventArgs.ExportContext.AddRow).
  • Insert an image into a specified cell range (ContextEventArgs.ExportContext.InsertImage).
  • Merge cells in a specified range into a single cell (ContextEventArgs.ExportContext.MergeCells).
NOTE

The AfterAddRow event is not currently supported when exporting data from Advanced Banded Grid Views.

Examples

This example uses the XlsxExportOptionsEx.AfterAddRow event to merge cells in rows in an XLSX document (a result of data exporting from a Grid Control). Rows that correspond to the grid control's group rows are merged using the ExportContext.MergeCells method.

For group rows, the DataSourceRowIndex event parameter returns negative values. The current row in the export output is specified by the DocumentRow parameter.

GridExportOutputResult

void options_AfterAddRow(AfterAddRowEventArgs e) {
    // Merge cells in rows that correspond to the grid's group rows.
    if (e.DataSourceRowIndex < 0) {
        e.ExportContext.MergeCells(new XlCellRange(new XlCellPosition(0, e.DocumentRow-1), new XlCellPosition(5, e.DocumentRow-1)));
    }
}

Implements

DevExpress.Export.IDataAwareExportOptions.AfterAddRow
See Also