XlsxExportOptionsEx.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.v24.1.Core.dll
NuGet Package: DevExpress.Printing.Core
Declaration
Remarks
To learn more about the functionality provided by this event, see XlsExportOptionsEx.AfterAddRow.
Note
The AfterAddRow event is not currently supported when exporting data from Advanced Banded Grid Views.
Example
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.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/winforms-grid-customize-data-aware-export-output
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)));
}
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AfterAddRow 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.