- First you need to create an action that returns a ContentResult
- In that action you create a new ContentResult and set the content type to “application/vnd.ms-excel”
- In the ContentResult you set the Content to an xml representation of an excel document ( refer to wikipedia: http://en.wikipedia.org/wiki/Microsoft_Office_XML_formats )
- return said ContentResult and a user browsing your page will be prompted to open up excel and view your report.
Code Snippet here: http://gist.github.com/94542
Advertisement