After researching this for some time I found an excellent article that provides a convenient solution from Matt Berseth: http://mattberseth.com/blog/2007/04/export_gridview_to_excel_1.html
Like most solutions to this problem, this article describes how to make ASP.NET re-render the GridView in a cleaned-up HTML format and then serve that rendering as a download. The downside to this is that it doesn't work with OpenOffice (this would require the Grid to be re-rendered as CSV rather than HTML).
The nice thing about this solution is that code can be easily customized. My GridViews contain images (as HTML images, not ImageButtons), so I added code to either eliminate them or render them in text.
No comments:
Post a Comment