Joe
Joe

Reputation: 83

Can Microsoft Report (RDLC) be used to print from a Console Application

We currently have a report done in Crystal Reports that prints reports from a console application. The report is never displayed on screen. It simply prints the batch of reports from the data provided. Because of some environmental issues with Crystal Reports, I have been looking at using Microsoft Report instead.

While I have been able to create a report in a console application, and attach it to the database, it does not appear to me to be any way to address the report programatically, let alone execute and print it. Is this a correct assessment?

Upvotes: 0

Views: 3335

Answers (1)

Pete
Pete

Reputation: 6723

Using Microsoft Report, you can load and export reports without using the report viewer.

Here's an example from MS using a LocalReport:

http://msdn.microsoft.com/en-us/library/microsoft.reporting.winforms.localreport(v=vs.80).aspx

You'll notice that while the example takes place in a button click event, it doesn't actually rely on any UI methods and will function equally well from a console application.

The same technique works with a ServerReport.

If you're using Sql Server Reporting Services, you can use the web services (http://msdn.microsoft.com/en-us/library/ms152787.aspx) to do pretty much the same thing.

In each of these cases, you'd export the report to a format to one of the supported formats. There is probably more information available on the SSRS side, but a lot of the things it discusses will be applicable to the Microsoft Report stuff (for example, DeviceInfo settings are available here: http://msdn.microsoft.com/en-us/library/ms155395.aspx)

Upvotes: 2

Related Questions