Version

InitializeRow Event

Occurs when a row is initialized.
Syntax
'Declaration
 
Public Event InitializeRow As InitializeRowEventHandler
public event InitializeRowEventHandler InitializeRow
Event Data

The event handler receives an argument of type ExcelExportInitializeRowEventArgs containing data related to this event. The following ExcelExportInitializeRowEventArgs properties provide information specific to this event.

PropertyDescription
CurrentColumnIndex (Inherited from Infragistics.Win.UltraWinGrid.ExcelExport.ExcelExportEventArgs)Zero-based index of current exporting column in excel worksheet.
CurrentOutlineLevel (Inherited from Infragistics.Win.UltraWinGrid.ExcelExport.ExcelExportEventArgs)Current outline level used for grouping.
CurrentRowIndex (Inherited from Infragistics.Win.UltraWinGrid.ExcelExport.ExcelExportEventArgs)Zero-based index of current exporting row in excel worksheet.
CurrentWorksheet (Inherited from Infragistics.Win.UltraWinGrid.ExcelExport.ExcelExportEventArgs)Current exporting worksheet.
Row Grid row.
SkipDescendants Specifies whether to skip the descendats of the current row.
SkipRow Specifies whether to skip the current row.
SkipSiblings Specifies whether to skip sibling rows of the current row.
TerminateExport Specifies whether to terminate the export process. Current row will not be processed.
Workbook (Inherited from Infragistics.Win.UltraWinGrid.ExcelExport.ExcelExportEventArgs)Exporting workbook.
Remarks

The Row argument returns a reference to a grid row which is being exported.

The SkipRow argument specifies whether to skip the current row. This argument doesn't affect exporting of descendant rows.

The SkipDescendants argument specifies whether to skip the descendats of the current row.

The SkipSiblings argument specifies whether to skip sibling rows of the current row.

The TerminateExport argument specifies whether to terminate the export process. Current row will not be processed.

Additionaly this event has Workbook, CurrentWorksheet, CurrentRowIndex, CurrentColumnIndex, CurrentOutlineLevel arguments inherited from ExcelExportEventArgs.

This event is fired for every grid row which is being exported, and before RowExporting and RowExported are fired. Use this event to set grid row specific properties and to control exporting process.

Example
Following code shows how to use InitializeRow event to control the flow of exporting process of a grid with hierarchical data.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Private Sub MyGridExporter_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.ExcelExport.ExcelExportInitializeRowEventArgs) Handles MyGridExporter.InitializeRow
    If e.Row.Band.Index = 0 And e.Row.Index = 0 Then e.SkipRow = True
    If e.Row.Band.Index = 0 And e.Row.Index = 2 Then e.SkipDescendants = True
    If e.Row.Band.Index = 1 And e.Row.Index = 0 Then e.SkipSiblings = True
    If e.Row.Band.Index = 0 And e.Row.Index = 7 Then e.TerminateExport = True
End Sub
public void InitializeRowEH(object sender, ExcelExportInitializeRowEventArgs e)
{
	if(e.Row.Band.Index==0 && e.Row.Index==0)
		e.SkipRow = true;

	if(e.Row.Band.Index==0 && e.Row.Index==2)
		e.SkipDescendants = true;

	if(e.Row.Band.Index==1 && e.Row.Index==0)
		e.SkipSiblings = true;

	if(e.Row.Band.Index==0 && e.Row.Index==7)
		e.TerminateExport = true;
}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also