项目作者: SyncfusionExamples

项目描述 :
DataGrid export to excel in VB .NET?
高级语言: Visual Basic .NET
项目地址: git://github.com/SyncfusionExamples/DataGrid-export-to-excel-in-VB-.NET-.git


DataGrid export to excel in VB.NET

About the sample

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.

  1. Imports Syncfusion.UI.Xaml.Grid.Converter
  2. Imports Syncfusion.XlsIO
  3. Dim options = New ExcelExportingOptions()
  4. options.ExcelVersion = ExcelVersion.Excel2013
  5. Dim excelEngine = dataGrid.ExportToExcel(dataGrid.View, options)
  6. Dim workBook = excelEngine.Excel.Workbooks(0)
  7. workBook.SaveAs("Sample.xlsx")

KB article - DataGrid export to excel in VB.NET

Requirements to run the demo

Visual Studio 2015 and above versions