5

スタンドアロンの実行可能ファイルで、ReportViewerコントロールを表示せずに、レポートを生成してPDF(またはレポートビューアから利用できる他のエクスポートオプションの1つ)として出力することはできますか?

レポート定義は実行可能ファイルに埋め込まれている必要があり、ReportingServicesWebサービスを使用しないでください。

4

3 に答える 3

7

実際、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
于 2008-09-26T08:48:19.410 に答える
4

コントロール自体を表示する必要はありません。

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を確認してください。

于 2008-09-26T08:01:23.140 に答える
1

パラメーターを使用して .rdlc レポートを直接 pdf に渡すことはできますか? レポートをプルするドロップダウンリストが 2 つあります。pdf に自動的にエクスポートするときに、パラメーターを機能させることができません。Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: レポートの実行に必要な 1 つ以上のパラメーターが指定されていません。

レポートビューアを使用するとドロップダウンリストが機能しますが、この手順をスキップしたいと思います。パラメータがない場合は、データを直接pdfに移動することもできます。私のドロップダウンリストは ddlyear と ddlmonth と呼ばれています。

于 2008-12-09T22:00:43.687 に答える