答案1
该代码在 Web API 中如下所示。
var data = new Microsoft.Reporting.WebForms.ReportDataSource(dataSourceName, dataSource);
string mimeType;
var report = new ReportBuilder()
.ReportPath(reportPath)
.DataSource(data)
.Build(ReportFormat.Pdf);
var bytes = report.Render(out mimeType);
var contentDisposition = new ContentDisposition
{
FileName = "FilenameSetInContentDisposition",
Inline = false,
};
Response.AppendHeader("Content-Disposition", contentDisposition.ToString());
return this.File(bytes, mimeType);