ultragrid Header row formating

Aug 10 2010 2:34 AM
hai every one ,

this is koti i am developing windows application in that i want to export the ultraGrid data to excel sheet through UltraGridExcelExporter data will be exported successfully but the header rows can't came in excel sheet by default it was came but formatting that headers and rows i use headerRow Exporting ,RowExporting events the heading will not display what is the problem the following is the code see....

Header row exporting

Private Sub UltraGridExcelExporter1_HeaderRowExporting(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.ExcelExport.HeaderRowExportingEventArgs) Handles UltraGridExcelExporter1.HeaderRowExporting
        ' e.Cancel = True
        Dim theHeaderFormat As IWorksheetCellFormat = e.Workbook.CreateNewWorksheetCellFormat()
        theHeaderFormat.Font.Bold = ExcelDefaultableBoolean.[True]
        theHeaderFormat.Font.Name = "Comic Sans"
        theHeaderFormat.Font.Color = Color.Blue
        theHeaderFormat.FillPatternBackgroundColor = Color.LightGray
        e.GridRow.Cells(0).Value = e.GridRow.Cells(0).Text
        For Each ucell As UltraGridCell In e.GridRow.Cells
            If Not ucell.Hidden Then
                e.CurrentWorksheet.Rows(e.GridRow.Index).Cells(ucell.Column.Index).Value = ucell.Column.Header.Caption.ToString()
                e.CurrentWorksheet.Rows(e.GridRow.Index).Cells(ucell.Column.Index).CellFormat.SetFormatting(theHeaderFormat)
                'MessageBox.Show(e.CurrentWorksheet.Rows(e.GridRow.Index).Cells(ucell.Column.Index).Value)
            End If
        Next
    End Sub

row exporting

Private Sub UltraGridExcelExporter1_RowExporting(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.ExcelExport.RowExportingEventArgs) Handles UltraGridExcelExporter1.RowExporting
        e.Cancel = True
        If isHeader Then
            _theCellFormat = e.Workbook.CreateNewWorksheetCellFormat()
            _theCellFormat.Font.Bold = ExcelDefaultableBoolean.[False]
            _theCellFormat.Font.Name = "Comic Sans"
            _theCellFormat.Font.Color = Color.Black
            For Each ucell As UltraGridCell In e.GridRow.Cells
                e.CurrentWorksheet.Rows(e.GridRow.Index).Cells(ucell.Column.Index).Value = ucell.Value
                e.CurrentWorksheet.Rows(e.GridRow.Index).Cells(ucell.Column.Index).CellFormat.SetFormatting(_theCellFormat)
            Next
        End If
    End Sub