Nhuren
Nhuren

Reputation: 513

Export Datagridview records to Excel

Hey friends i need to export records of datagridview of winform to MSExcel. I want to do it without using any DLL i.e., with the buid in properties of C#. So is there any good solution for my problem?

Upvotes: 7

Views: 1236

Answers (4)

suely
suely

Reputation: 434

I followed this video tutorial, in 10min you can do it, you must use the System.Data.SqlClient reference, make a method, and override, the code for the button, and put the gridview in a form tag, here is the link export from datagridview to excel

Upvotes: 0

gordanvij
gordanvij

Reputation: 1080

You can read the values from data grid using reflection or you can take your data model which is bound to the data grid and create a csv file. The csv file can be read by MS Excel.

Upvotes: 0

GregC
GregC

Reputation: 8007

A common way to do this would be through MSOffice PIAs. Is that what you'd like to avoid?

Upvotes: 0

ChrisWue
ChrisWue

Reputation: 19060

Export the data as CSV file. Excel can read those fine.

Upvotes: 3

Related Questions