Home
Manage Your Code
Snippet: Export DataGridView to Excel worksheet (C#)
Title: Export DataGridView to Excel worksheet Language: C#
Description: takes the contents of the datagridview and then creates an excel worksheet with the data. Views: 391
Author: Charley McCollum Date Added: 12/3/2008
Copy Code  
1#region Export to Excel   ...#endregion
110
Usage
takes the contents of the datagridview and then creates an excel worksheet with the data. 
add using System.Reflection; to the using statements and then add the code to the class 
and call it passing in the datagridview and true of false based on if there are headers in 
the columns or not.
Notes
This was posted to the code guru in a forum @ http://www.codeguru.com/forum/archive/index.php/t-421702.html credit goes to the user cthogg2004