Exporting a RadGrid to XLSX

 

Imports Telerik.WinControls.Export
Imports Telerik.WinControls.UI
Imports Telerik.WinControls
 
Private Sub ExportGridToXlsx(grid As RadGridView, outputPath As String)
 
    Dim exporter As New GridViewSpreadExport(grid)
    exporter.ExportFormat = SpreadExportFormat.Xlsx
    exporter.FileExportMode = FileExportMode.CreateOrOverrideFile
    exporter.SheetName = "Export"
    exporter.HiddenColumnOption = HiddenOption.DoNotExport
    exporter.HiddenRowOption = HiddenOption.DoNotExport
    exporter.ExportVisualSettings = True   ' Keeps formatting, colors, fonts, etc.
 
    Dim renderer As New SpreadExportRenderer()
 
    Try
        exporter.RunExport(outputPath, renderer)
        MessageBox.Show("Export complete: " & outputPath)
 
    Catch ex As Exception
        MessageBox.Show("Export failed: " & ex.Message)
    End Try
 
End Sub

 


RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences