ReportViewerクラスの代わりに使用するReportExporterクラスがネイティブに存在しましたが、サポートされなくなりました。 3番目の部分も同様です。
私はこのコードサンプルを使用します(あなたはどこか別のセッション、のQueryStringまたはからまだ持っていない場合)
がレポートからパラメータ値を取得します
string myParamName="XXX";
object myParamValue;
foreach (ParameterField field in reportDocument.ParameterFields)
{
if (string.Compare(field.Name.TrimStart('@'), myParamName, true) == 0)
myParamValue= field.CurrentValues;
}
輸出
を必要とレポート名を使用して
string myReportName = "sales for " + myParamValue.ToString() + ".pdf";
try
{
reportDocument.ExportToHttpResponse(
ExportFormatType.PortableDocFormat
,Response, true, myReportName);
}
catch (System.Threading.ThreadAbortException)
{
//System.Threading.ThreadAbortException is thrown
//because, Response.End is called internally in ExportToHttpResponse method:
}
私はそのレポートのDocumentNameプロパティを信じています – sam