我正在尝试编写一个函数来将rdlc报告作为pdf保存到指定位置,但是我得到了异常
“报告'Reports / AsrPhoneList.rdlc'的报告定义没有 被指定为“。
如果有任何多余的事情让我知道,我是新手。
void SaveReport()
{
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
string saveFilePath = string.Concat(@"c:\Users\", windowsUserName, @"\Desktop\CurrentStatus.pdf");
ReportViewer reportViewer = new ReportViewer();
reportViewer.LocalReport.ReportPath = "Reports/AsrPhoneList.rdlc";
reportViewer.ProcessingMode = ProcessingMode.Local;
byte[] bytes = reportViewer.LocalReport.Render(
"PDF", null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
using (FileStream fs = new FileStream(saveFilePath, FileMode.Create))
{
fs.Write(bytes, 0, bytes.Length);
}
}