views:

510

answers:

2

I have a webpart which uses SPGridView to render tabulated data. I need to provide a button in the webpart, which upon clicking will export the SPGridView into a document, preferably, an Excel Sheet or a Word document. How do I export the data from an SPGridView?

A: 

To export to an .xls file look at this sample code.

To export to a .csv file here's another post, it's for exporting from a GridView but should work for SPGridView as well.

dstetsenko
A: 

http://mattberseth.com/blog/2007/04/export_gridview_to_excel_1.html

I have used it for the SPGridView as well...

Johan Leino