How Do I export data from a Gridview to an Excel sheet
I have a VB.Net application and once the data in the G开发者_JAVA百科ridview is populated I require it to be exported to an Excel sheet. Access (.MDB) is the database used. Please help!
Any awesome links or tips?
Thanks!
I would suggest that you read throught the Gridview and write the info in a .csv file, using ',' (commas) as your separator (delimiter). Then you can just upload that file to your database (probably check if there already is one in the db, then just delete and override)
Hope this helps, KrizD
You can use a library like NPOI (for office 2003 format) or EPPlus (for office 2007 format).
They are pretty easy to use and you don't have to reference Office interop assemblies.
精彩评论