How to create a PDF from a built-in report definition without a server or interface?

Is it possible for a stand-alone executable to generate a report and output it as a PDF (or one of the other export options available from the report viewer) without displaying the ReportViewer control?

The report definition must be embedded in the executable and must not use the Reporting Services web service.

+5
source share
3 answers

Actually, you don’t need a ReportViewer at all, you can directly create an instance and use LocalReport:

LocalReport report = new LocalReport();
report.ReportPath = "templatepath";
// or use file from resource with report.ReportEmbeddedResource

// add parameters, datasource, etc.

Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;

byte[] bytes;
bytes =report.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);

// save byte[] to file with FileStream or something else
+7
source

You do not need to show the control itself.

ReportViewer rv = new ReportViewer();
rv.LocalReport.ReportPath = "templatepath";
// or use file from resource with rv.LocalReport.ReportEmbeddedResource

// add parameters, datasource, etc.

Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;

byte[] bytes;
bytes = rv.LocalReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);

// save byte[] to file with FileStream or something else

PDF XLS ( ReportViewer Word , Reportig).

, - #, .NET framework ReportViewer. GotReportViewer .

+4

.rdlc pdf ? dropdownlists, . pdf. , : Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: , , .

Dropdownlists lists work when I use Reportviewer, but I want to skip this step. I can also get my data to go directly to pdf if it does not have any parameters. My dropdownlists are called ddlyear and ddlmonth.

+1
source

All Articles