export DataGridView to Excel in .NETHave you ever had a WinForm that shows a nice report inside a DataGridView? It looks great! Now, you want to export this report to Excel and you’re asking yourself, “How can I do this?”. You have the button that it says “Export to Excel”, but now “What should I do?”. If this is your case, you are now on the right page. If you have never confronted with this situation, who knows, maybe tomorrow will surprise you and you can be ready from now on. See..you’re still on the right page.

EasyXLS Excel library makes such tasks so much easier to achieve. When it comes to export data to Excel, EasyXLS is the best choice. It offers all kind of methods and solutions that make complicated things uncomplicated when Excel files are involved.

Now, let’s get back to our DataGridView and “Export to Excel” button. Using EasyXLS, you can export DataGridView to XLSX, XLS, XLSM or XLSB file formats. The Excel file can also have multiple sheets and you can choose the right sheet where the DataGridView can fit. Do you have a huge DataGridView? EasyXLS handles very well exporting large data to Excel. If I have captured your attention, see here how to export DataGridView to Excel in C# and VB.NET.

In most of the cases the data source of the DataGridView is a DataTable. If so, have you ever thought that the export to Excel can be done with one line of code? Check this sample on exporting DataTable to Excel file in C# and VB.NET.

Now get your keyboard back to work. Happy coding!

(0) Comments    Read More   
Post a Comment
Name:
Email:
Website:
Comments: