DataGrid export to excel in VB .NET?
This example illustrates how to export the WPF DataGrid (SfDataGrid) to excel.
WPF DataGrid (SfDataGrid) provides support to export data to excel. It provides exporting support for grouping, filtering, sorting, paging, unbound rows, stacked headers, merged cells and details view.
The following assemblies needs to be added for exporting to excel.
• Syncfusion.SfGridConverter.WPF
• Syncfusion.XlsIO.Base
Exporting the DataGrid to excel can be performed by using ExportToExcel extension method present in Syncfusion.UI.Xaml.Grid.Converter namespace.
Imports Syncfusion.UI.Xaml.Grid.Converter
Imports Syncfusion.XlsIO
Dim options = New ExcelExportingOptions()
options.ExcelVersion = ExcelVersion.Excel2013
Dim excelEngine = dataGrid.ExportToExcel(dataGrid.View, options)
Dim workBook = excelEngine.Excel.Workbooks(0)
workBook.SaveAs("Sample.xlsx")
KB article - DataGrid export to excel in VB.NET
Visual Studio 2015 and above versions