Microsoft control is a new control which has numerous features than control like sorting, etc. This article explains how the data can be exported from DataGridView to Excel with its column header and cell formatting using XlsIO.
Steps to export DataGridView to an Excel file programmatically:
Include the following namespace to create new DataGridView object.
Include the following namespace for XlsIO.
After the initialization set valid data sources to the DataGridView’s DataSource property. Here the DataTable object has been used for the DataSource property.
Note: GetDataTable() method returns DataTable of applicable data to import.
Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to to learn about generating and registering Syncfusion license key in your application to use the components without trail message.
This page will automatically be redirected to the sign-in page in 10 seconds.