How to display a SQL Reporting Service report in Excel - c#

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?

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.

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.

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

Related

Integrating SharePoint 2013 with SSRS report Data or Extracting Data from SSRS into SharePoint using a TimerJob

I have a requirement to get data out of an SQL Server Reporting Services based system straight into a SharePoint list from where that data will then be processed.
At present, users export the data into an Excel spreadsheet and then start modifying columns on that spreadsheet and exchange it among various stakeholders every two hours.
My intention is to bypass the export to Excel portion of the current process and instead create a timer job (created using .NET, C# and SSOM) that gets the data directly out of SSRS into my SharePoint List.
Thank you
If you familiar with SSRS, I suppose you know ETL also, so you could import the updated excel spreadsheet(maybe from a fixed path, so you just need save the files there) to a SQL Server table. Then create external content type from the table and display data in SharePoint by creating external list.
One thread for your reference

SSRS export report using C#

I want to ask is there any way to export SSRS report programmatic using C#
Export through ssrs report using C# When reports Run it should save on local disk
Please see the image screen shot
enter image description here
Like i dont want to export like this as above screen shot...
i want it like when report click it should be export or save in local disk
is there any code then please help me
Yes you can. Search for "ReportExecutionService SSRS C#". You can then just specify whether you want Excel or PDF in the line ".Render(format, ...."
An example can be found at http://www.aspose.com/docs/display/wordsreportingservices/rendering+reports+programmatically
If you want to automatically save the report when you display it with the Report Manager website, then it is not possible.
You create a client/web application and use the Reporting Services Web Service (here are the supported formats) to render the report, but you wouldn't be able to trigger your application from the Report Manager.
If your users really need to display and save the report at the same time, then you could use ReportViewer controls in your application and add some code to save the report automatically when the user display a report.
It would fit your needs but will take some time to develop, because you will need to redevelop a "report explorer" to browse in the different folders if you need to have the same user experience.

How do I run a SSRS report from C# using a C#-produced dataset and export a PDF file?

I am looking at using SSRS for some reporting.
I want to have a C# console program that runs the SSRS report.
The C# program will save an exported PDF file locally.
The C# program will run locally.
The SSRS report is on another computer on the same domain. All users can access this via a UNC path.
The C# program will run some calculations on some raw database data, and the results will be the dataset that the SSRS report uses for its charts and tables.
I am having trouble figuring out how to set up a process to do this. What's the best way to access the report from a C# program? Using the full UNC path, using a service reference to the ReportService2010.asmx file, using a web reference to the ReportService2010.asmx file, or something else? How can I provide the SSRS report with a dataset to use for its charts and tables? How do I programmatically export a PDF file?
As you can tell, I'm very new to SSRS. The tutorials I've found online either go into too much depth, or not enough.
You need to either pull the report into your application in a reportviewer control in order to supply it with your dataset directly, or your C# program is going to need to insert the data into a database for the SSRS server to process it.
Fortunately, that's the hard part. Since the report is hosted on another server, you can easily access it directly, rendered in the PDF format you desire. Access the report via the ReportServer endpoint url (by default it'll be SSRSServerURL/ReportServer), and supply it with any necessary parameters, and the appropriate commands to render (&rs:Command=Render&rs:Format=PDF). For example:
http://SSRSNode001/ReportServer/Pages/ReportViewer.aspx?%2fSAMPLEFOLDER%2fSUBFOLDER%2fMYREPORT&PARAM1=123&PARAM2=321&rs:Command=Render&rs:Format=PDF
If you end up using a local reportviewer control, you should still be able to have the rendered produce a PDF output.

Save Excel as Image in SQL Server Field

I am converting an MS Access 2003 application to C# (VS 2010) and SQL Server 2008.
It's all pretty basic except for one thing. I've got embedded excel spreadsheets in the application. In Access they are edited and saved as OLE DB objects. The spreadsheet is then displayed as an image in the report. I have converted the Access Reports to Crystal Reports and converted data shows just fine in the reports.
I can create the spreadsheet and save it to a file, but what I can't figure out is how to create and save an Excel Spreadsheet as an image in my SQL Server field so Crystal can put it in the report.
I also know images are deprecated in SS 2008 so any ideas on how to move my whole report to something else would be appreciated.
FYI: An older post suggested Lenni Lobel's articles, but they are not there anymore.
Sounds like there are two requirements here:
Be able to access the file data via Crystal
Be able to efficiently store a spreadsheet in a SQL Server 2012 database column.
Your choices (other than Image columns) would appear to be FileStream and VarBinary. Here's a comparison: VARBINARY vs. FILESTREAM.
I can't comment on Crystal's ability to access either of those, unfortunately.
You can use OLE object in Crystal reports to show the excel file (without saving it as a picture) This will probably work fine for all computers where Excel is installed.

Export unformatted Excel data from Crystal Reports

I need to export excel file with crystal report.
Is there any way to export data only without formatting by using code?
You can export data shown in the report without formatting, in different ways:
1- Replace the CrystalReportViewer Control with the ReportExporter Control. It will export the report in the format you choose.
2- Call ExportToHttpResponse method
CrystalReportSource1.ReportDocument.ExportToHttpResponse(ExportFormatType.ExcelRecord, this.Response , false, "report.xls");`
3- Call ExportToDisk method
reportDocument.ExportToDisk(ExportFormatType.ExcelRecord, "report.xls");
4- Export dataset to excel (Look at Ahmed answer)
You can choose the way that best fits your needs, but you must try if it works with the runtime you use either in development or in release server.
ExportFormatType.ExcelRecord means that is generated an xls file, without formatting. If you set ExportFormatType.Excel fields that are marked as "Can Grow" are merged with an otherwise blank row below them..

Categories