如何创建显示图像的报告(RDLC)
本文关键字:图像 报告 RDLC 显示图 显示 创建 何创建 | 更新日期: 2023-09-27 18:09:46
如何在Wpf中创建显示图像的报告(RDLC
)。用实际例子解释:
这段代码不起作用:
reportViewer.LocalReport.ReportPath = @"C:'Users'dsingh'Documents'Visual Studio 2012'Projects'ReportViewerWPF'ReportViewerWPF'CustomerReport.rdlc";
reportViewer.LocalReport.EnableExternalImages = true;
string imagePath = @"C:'Users'dsingh'Documents'Visual Studio 2012'Projects'ReportViewerWPF'ReportViewerWPF'Penguins - Copy.jpg";
ReportParameter parameter = new ReportParameter("ImagePath", imagePath);
List<ReportParameter> obj = new List<ReportParameter>();
obj.Add(parameter);
reportViewer.LocalReport.SetParameters(obj);
reportViewer.LocalReport.Refresh();
尝试像这样更改imagePath
string imagePath=@"file:///C:'Users'dsingh'Documents'Visual Studio 2012'Projects'ReportViewerWPF'ReportViewerWPF'Penguins - Copy.jpg"
代替reportViewer.LocalReport.Refresh()使用
reportViewer.RefreshReport();
整个代码是这样的
reportViewer.LocalReport.ReportPath = @"C:'Users'dsingh'Documents'Visual Studio 2012'Projects'ReportViewerWPF'ReportViewerWPF'CustomerReport.rdlc";
reportViewer.LocalReport.EnableExternalImages = true;
string imagePath = @"file:///C:'Users'dsingh'Documents'Visual Studio 2012'Projects'ReportViewerWPF'ReportViewerWPF'Penguins - Copy.jpg";
ReportParameter parameter = new ReportParameter("ImagePath", imagePath);
List<ReportParameter> obj = new List<ReportParameter>();
obj.Add(parameter);
reportViewer.LocalReport.SetParameters(obj);
reportViewer.RefreshReport();
确保您在rdlc中正确定义了Report Parameter。