locked
Export data to excel RRS feed

  • Question

  • Hi friends. Can anyone guide me in developing a report with a custom "Export to Excel" button. Of course one can perform the same task by right clicking the report and selecting the export to excel option. However my requirement demands a custom export to excel button. When the user clicks the button, it should export the entire data to an excel file. Is this possible in SSRS 2008? If it is possible then what can be the possible approach i can follow to get the task done?

     

    Thanks in advance.

    Monday, February 14, 2011 4:20 PM

Answers

  • Hi Samir,

    The URL string in the Action hypelinks can be written as an expression, like ="......&Country=" & Parameters!Country.Value & "&rs:Comand=Render&rs:Format=Excel".

    thanks,
    Jerry

    • Proposed as answer by vikram kansal Wednesday, February 16, 2011 10:43 AM
    • Marked as answer by Challen Fu Wednesday, February 23, 2011 10:20 AM
    Wednesday, February 16, 2011 8:23 AM

All replies

  • You can issue Reporting Services commands through parameters in a URL. If you create a button (e.g. a textbox) with an action that points to the url of the deployed report and include the parameters &rs:Comand=Render&rs:Format=Excel then you should get what you're after.

    e.g. http://<servername>/reportserver?/<ReportFolder>/<ReportName>&rs:Comand=Render&rs:Format=Excel

    (If you deploy to a SharePoint environment the path will be a little different. Likewise if you're testing the report on a local host you'll need to use the appropriate path.)

    This alone would run the report with default parameters but you can also pass parameters through the url with &<ParameterName>=<ParameterValue> . If oyu need to do this, you'l probably need to write an expression to create the correct url.


    Ray If this post, or another, answers your question, please click the 'Mark as answer' button so others with the same problem can find a solution more easily.
    • Proposed as answer by Jerry Nee Wednesday, February 16, 2011 8:19 AM
    Monday, February 14, 2011 6:54 PM
  • Having used the URL format "http://<servername>/reportserver?/<ReportFolder>/<ReportName>&rs:Comand=Render&rs:Format=Excel " , i can generate the excel report but the problem is my report also contains parameters used for filtering the data. If i use &<ParameterName>=<ParameterValue> (for eg: &Country=Netherlands), then i can get the filtered results as desired. However if i try to make it dynamic by trying to retrieve the parameter values at runtime using a statement like &Country=Parameters!Country.Value, then it doesn't fetch the results as per the filtering. I mean it does not get the parameter values. How can i get the Parameter values in the url at runtime???????
    Tuesday, February 15, 2011 10:57 PM
  • Hi Samir,

    The URL string in the Action hypelinks can be written as an expression, like ="......&Country=" & Parameters!Country.Value & "&rs:Comand=Render&rs:Format=Excel".

    thanks,
    Jerry

    • Proposed as answer by vikram kansal Wednesday, February 16, 2011 10:43 AM
    • Marked as answer by Challen Fu Wednesday, February 23, 2011 10:20 AM
    Wednesday, February 16, 2011 8:23 AM
  • Yesterday, I found an articel which are very useful for exporting data to excel. It introduces how to use a small tool to export data. Also, it provides the data source by using C# of the tool.
    If you are interested in it, you can read it on

    http://www.dotnetspark.com/kb/3716-fast-export-data-from-database-to-excel.aspx

    Tuesday, February 22, 2011 3:44 AM