Version

SummaryCellExporting Event

Occurs before summary cell is exported to excel.
Syntax
'Declaration
 
Public Event SummaryCellExporting As SummaryCellExportingEventHandler
public event SummaryCellExportingEventHandler SummaryCellExporting
Event Data

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

PropertyDescription
Cancel (Inherited from System.ComponentModel.CancelEventArgs) 
CurrentColumnIndex (Inherited from Infragistics.Win.UltraWinGrid.ExcelExport.ExcelExportCancelEventArgs)Zero-based index of current exporting column in excel worksheet..
CurrentOutlineLevel (Inherited from Infragistics.Win.UltraWinGrid.ExcelExport.ExcelExportCancelEventArgs)Current outline level used for grouping.
CurrentRowIndex (Inherited from Infragistics.Win.UltraWinGrid.ExcelExport.ExcelExportCancelEventArgs)Zero-based index of current exporting row in excel worksheet.
CurrentWorksheet (Inherited from Infragistics.Win.UltraWinGrid.ExcelExport.ExcelExportCancelEventArgs)Current exporting worksheet.
Summary Summary value.
SummaryLevel Summary level.
Workbook (Inherited from Infragistics.Win.UltraWinGrid.ExcelExport.ExcelExportCancelEventArgs)Exporting workbook.
Remarks

The Summary argument returns a reference to a summary value.

The SummaryLevel argument returns current summary level.

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

This event is fired before excel cell with summary value is processed. Use Cancel argument to cancel cell exporting.

Example
Following code uses SummaryCellExporting event to apply custom formatting to grid summary appearance (before grid summary export has started) and SummaryCellExported event to apply custom formatting to excel cell (after grid summary was exported).

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_SummaryCellExporting(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.ExcelExport.SummaryCellExportingEventArgs) Handles MyGridExporter.SummaryCellExporting
    If e.CurrentColumnIndex Mod 2 = 0 And Not e.Summary Is Nothing Then
        e.Summary.Appearance.BackColor = Color.LightCoral
    End If
End Sub

Private Sub MyGridExporter_SummaryCellExported(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.ExcelExport.SummaryCellExportedEventArgs) Handles MyGridExporter.SummaryCellExported
    If e.CurrentColumnIndex Mod 2 = 0 And Not e.Summary Is Nothing Then
        Dim tmCF As IWorksheetCellFormat = e.CurrentWorksheet.Rows(e.CurrentRowIndex).Cells(e.CurrentColumnIndex).CellFormat
        tmCF.BottomBorderStyle = CellBorderLineStyle.Double
        tmCF.TopBorderStyle = CellBorderLineStyle.Double
        tmCF.LeftBorderStyle = CellBorderLineStyle.Double
        tmCF.RightBorderStyle = CellBorderLineStyle.Double
    End If
End Sub
private void SummaryCellExportingEH(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.SummaryCellExportingEventArgs e)
{
	if(e.CurrentColumnIndex%2==0 && e.Summary!=null)
		e.Summary.Appearance.BackColor = Color.LightCoral;
}

private void SummaryCellExportedEH(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.SummaryCellExportedEventArgs e)
{
	if(e.CurrentColumnIndex%2==0 && e.Summary!=null)
	{
		IWorksheetCellFormat tmCF = e.CurrentWorksheet.Rows[e.CurrentRowIndex].Cells[e.CurrentColumnIndex].CellFormat;
		tmCF.BottomBorderStyle = tmCF.TopBorderStyle = tmCF.LeftBorderStyle = tmCF.RightBorderStyle = CellBorderLineStyle.Double;
	}		
}
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