我想将rdl
导出到pdf
,并且报告中包含查询和数据集在报告中设置的所有内容。我正在使用此代码,但它给了我一个错误
ReportViewer reportViewer = new ReportViewer();
reportViewer.ProcessingMode = ProcessingMode.Local;
reportViewer.SizeToReportContent = true;
reportViewer.Width = Unit.Percentage(900);
reportViewer.Height = Unit.Percentage(900);
string filePath = HttpContext.Current.Server.MapPath(@"~/Reports/Reports.rdl");
reportViewer.LocalReport.ReportPath = HttpContext.Current.Server.MapPath(@"~/Reports/Reports.rdl");
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
byte[] bytes = reportViewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
using (FileStream fs = new FileStream(filePath, FileMode.Create))
{
fs.Write(bytes, 0, bytes.Length);
}
请帮我解决这个问题..?