RDLC加载图片时,需要将reporViewer属性LocalReport——>EnableExternalImages设置为True,确定呈现外部图像。
图像加载代码:
string absolutePath = Path.GetFullPath(picture.Path);//获取绝对路径
string picPath = "file:///" + absolutePath.Replace(@"\", "/");//将路径转换为RDLC所需的格式
List<ReportParameter> paras = new List<ReportParameter>();
paras.Add(new ReportParameter("PicturePath", picPath));
return paras;