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?
-
How can i make CSV file? and another problem is when click event for Export fires then automatically MS Excel should open with the records in the datagrid view.I will be very grateful if anyone provide some sample codeNhuren– Nhuren2011-04-17 08:18:42 +00:00Commented Apr 17, 2011 at 8:18
-
Thankx for all i was able to do it with the simple code:Nhuren– Nhuren2011-04-20 07:15:08 +00:00Commented Apr 20, 2011 at 7:15
Add a comment
|
4 Answers
A common way to do this would be through MSOffice PIAs. Is that what you'd like to avoid?
1 Comment
GregC
PIA = Primary Interop Assembly. Allows you to create an Excel process and manipulate it.
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