'宣言 Public ReadOnly Property HeaderType As HeaderTypes
public HeaderTypes HeaderType {get;}
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; }