スタンドアロンの実行可能ファイルで、ReportViewerコントロールを表示せずに、レポートを生成してPDF(またはレポートビューアから利用できる他のエクスポートオプションの1つ)として出力することはできますか?
レポート定義は実行可能ファイルに埋め込まれている必要があり、ReportingServicesWebサービスを使用しないでください。
スタンドアロンの実行可能ファイルで、ReportViewerコントロールを表示せずに、レポートを生成してPDF(またはレポートビューアから利用できる他のエクスポートオプションの1つ)として出力することはできますか?
レポート定義は実行可能ファイルに埋め込まれている必要があり、ReportingServicesWebサービスを使用しないでください。
実際、ReportViewer はまったく必要ありません。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
コントロール自体を表示する必要はありません。
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コントロールはReportig ServiceのようにWordなどにエクスポートできないため)。
上記のコードは、.NET FrameworkとReportViewerコントロールを使用したC#であることを忘れました。クイックスタートについては、 GotReportViewerを確認してください。
パラメーターを使用して .rdlc レポートを直接 pdf に渡すことはできますか? レポートをプルするドロップダウンリストが 2 つあります。pdf に自動的にエクスポートするときに、パラメーターを機能させることができません。Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: レポートの実行に必要な 1 つ以上のパラメーターが指定されていません。
レポートビューアを使用するとドロップダウンリストが機能しますが、この手順をスキップしたいと思います。パラメータがない場合は、データを直接pdfに移動することもできます。私のドロップダウンリストは ddlyear と ddlmonth と呼ばれています。