バージョン

HeaderRowExporting イベント

ヘッダー行がExcelにエクスポートされる前に発生します。
シンタックス
'宣言
 
Public Event HeaderRowExporting As HeaderRowExportingEventHandler
public event HeaderRowExportingEventHandler HeaderRowExporting
イベント データ

イベント ハンドラが、このイベントに関連するデータを含む、HeaderRowExportingEventArgs 型の引数を受け取りました。次の HeaderRowExportingEventArgs プロパティには、このイベントの固有の情報が記載されます。

プロパティ解説
Band ヘッダーに関連付けられたUltraGridBand。
Cancel System.ComponentModel.CancelEventArgsから継承されます。 
CurrentColumnIndex Infragistics.Win.UltraWinGrid.ExcelExport.ExcelExportCancelEventArgsから継承されます。Excelワークシート内の、現在エクスポート中の列の0から始まるインデックス。
CurrentOutlineLevel Infragistics.Win.UltraWinGrid.ExcelExport.ExcelExportCancelEventArgsから継承されます。グループ化に使用されている現在のアウトラインレベル。
CurrentRowIndex Infragistics.Win.UltraWinGrid.ExcelExport.ExcelExportCancelEventArgsから継承されます。Excel ワークシート内の、現在エクスポート中の行の0から始まるインデックス。
CurrentWorksheet Infragistics.Win.UltraWinGrid.ExcelExport.ExcelExportCancelEventArgsから継承されます。現在エクスポート中のワークシート。
GridRow ヘッダーに関連付けられたUltraGridRow。
HeaderType ヘッダーのタイプ。
Workbook Infragistics.Win.UltraWinGrid.ExcelExport.ExcelExportCancelEventArgsから継承されます。エクスポート中のワークブック。
解説

Band 引数はヘッダーに関連付けられた UltraGridBand への参照を返します。

GridRow 引数はヘッダーに関連付けられた UltraGridRow への参照を返します。

HeaderType 引数はヘッダーのタイプを返します。

また、このイベントには、ExcelExportCancelEventArgs から継承された Workbook、CurrentWorksheet、CurrentRowIndex、CurrentColumnIndex、CurrentOutlineLevel などの引数もあります。

このイベントは、ヘッダー値を持つExcel行が処理される前に発生します。Cancel 引数を使用して行のエクスポートをキャンセルできます。ヘッダーが(行レイアウトモードで見られるように)複数のExcel行にわたる場合、このイベントは最初のヘッダー行に対してのみ発生します。

使用例
Private Sub MyGridExporter_HeaderRowExporting(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.ExcelExport.HeaderRowExportingEventArgs) Handles MyGridExporter.HeaderRowExporting
    If e.HeaderType = HeaderTypes.BandHeader Then
        e.Band.Header.Appearance.BackColor = Color.LightBlue
    End If
End Sub

Private Sub MyGridExporter_HeaderRowExported(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.ExcelExport.HeaderRowExportedEventArgs) Handles MyGridExporter.HeaderRowExported
    ' CurrentRowIndex is incremented after the row is exported
    Dim tmRow As WorksheetRow

    tmRow = e.CurrentWorksheet.Rows(e.CurrentRowIndex - 1)

    If Not tmRow.Cells(e.CurrentColumnIndex).AssociatedMergedCellsRegion Is Nothing Then
        ' band header is exported as merged region
        tmRow.Cells(e.CurrentColumnIndex).CellFormat.Rotation = 45
    Else
        ' column headers are exported as normal cells
        tmRow.CellFormat.Rotation = 45
    End If

    tmRow.Height = 65 * 20
End Sub
private void HeaderRowExportingEH(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.HeaderRowExportingEventArgs e)
{
	if(e.HeaderType==HeaderTypes.BandHeader)
		e.Band.Header.Appearance.BackColor = Color.LightBlue;
}

private void HeaderRowExportedEH(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.HeaderRowExportedEventArgs e)
{
	// CurrentRowIndex is incremented after the row is exported
	WorksheetRow tmRow = e.CurrentWorksheet.Rows[e.CurrentRowIndex-1];

	if(tmRow.Cells[e.CurrentColumnIndex].AssociatedMergedCellsRegion!=null)
		// band header is exported as merged region
		tmRow.Cells[e.CurrentColumnIndex].CellFormat.Rotation = 45;
	else
		// column headers are exported as normal cells
		tmRow.CellFormat.Rotation = 45;

	tmRow.Height = 65*20;
}
参照