views:

752

answers:

3

Hi everyone,

At the moment i am using VSTO to take a SQL Reporting Services report and display it in Excel 2003 using the ReportViewer control. So bascially on a winform hosted inside Excel.

But i also need to be able to display it without the ReportViewer control i.e. just straight into the cells of my Excel sheet.

I'm wonder how I should go about this.

I can retreive the report in CSV format. So should I just loop through the cvs formatted report and insert directly into my Excel sheet one row after another or is there a better way?

A: 

Viewing the Reporting Services reports in a web browser has an Export option right at the top of the report. Excel is one of those options. It even exports the formatting. Note that this is for SSRS 2005 - I do not know if anything changed in SSRS 2008.

HardCode
Thanks for the answer. Yea that is true, but my client wants to be able to click on a report name from the Excel menu and atomatically have it display in Excel. So I can't have the ReportViewer getting display at all. Do you know the best way to go about this?
+1  A: 

You might want to look at what I did trying to print a RS report without user input. It uses RS's web services endpoint to deliver the report into the application. The only difference is that instead of using an IMAGE format, you'd use an EXCEL format on the render call.

Jacob Proffitt
Hi Jocob, I've been reading what you did and I don't really get it. Will something similar allow me to produce the Excel output of my report in the current active sheet by clicking on a menu item?
It will allow you to retrieve the report from RS as a byte array representing the report as an Excel spreadsheet. You can stream that to disk or keep it in memory. From there, you can open it (you're already in VSTO) to merge the data to the current active sheet.
Jacob Proffitt
A: 

Can you not just dump the data directly into Excel using CopyFromRecordset?

Lunatik