Export CellSetGrid to Excel

I have searched the web trying to find a way to export CellSetGrid to Excel to no avail.  The good news is that CellSetGrid comes with source code thanks to the generous contribution from Richard Tkachuk.

My solution is to modify the CellSetGrid source code and make oCellSet a public member from the class CellSetState.  oCellSet is a Microsoft.AnalysisServices.AdomdClient.CellSet.   After you grab the CellSet, you can use code from khatri hitesh.

In Khatri Hitesh’s article and attached source code, he showed you how to iterate through the CellSet and write it to an ASP.NET Table control.  After you got the table control you can do a RenderControls and convert it to HTML table.  Then, the rest is to export this HTML table to excel which is pretty easy to do and you can google for the source code if you don’t already know how to do it.

Before coming up with this solution, I have tried to expose Mdx from CellSetState, but the thing is that the Mdx doesn’t include the named set that is created from a separate command.  It turned out that grabbing the oCellSet is the simplest way to get it ready for exporting to Excel.

Probably I am the first person who has come up with this solution.  Congrats to myself!!!  🙂

This entry was posted in Computers and Internet. Bookmark the permalink.

3 Responses to Export CellSetGrid to Excel

  1. A says:

    Indeed, Congrats to yourself ;).. Thank you for the solution.I tried everything you mentioned and the \’export to excel\’ feature works now. The only problem is it can export only 1 page at a time. I\’ve looked into some source code in the CellSetGrid package, but I have no idea so far about how to fix this problem. May I know if you encountered a similar problem. If so, can you please let me know how you handled it? Thanks!

  2. Jiang-ning says:

    i do have a solution. the idea is to get rid of paging and display everthing in one scrollable page.

  3. Grubby says:

    Jiang-ning. I’m looking for the CellSetGrid control and source code. Is it possible for you to email it to me ? sadly i can’t download it from Richard Tkachuk website (www.sqlserveranalysisservices.com/) as the domain has expired.

    Thanks

Leave a comment