如何在某些条件下(基于传递的参数)以编程方式在我的RDLC报告中添加水印?
overTimeReport.ReportPath = "Report\\OverTime.rdlc";
overTimeReport.DataSources.Clear();
overTimeReport.Refresh();
//---- Generate parameter list----
List<ReportParameter> paramList = new List<ReportParameter>();
ReportParameter param1 = new ReportParameter("check_state", check_state);
paramList.Add(param1);
overTimeReport.SetParameters(paramList);
ReportDataSource datasource = new ReportDataSource();
datasource = new ReportDataSource("DSOverTime", dt);
答案 0 :(得分:1)
将报告正文的背景图像设置为水印图像参数:
=Parameters!watermark.Value
根据您的&#34;条件&#34;设置条件水印参数。 (我假设您的情况会显示水印或不显示):
ReportParameter watermarkParameter = new ReportParameter("watermark", "", false);
if (showWatermark)
watermarkParameter = new ReportParameter("watermark", Uri(watermarkPath).ToString(), false);
不要忘记将水印参数添加到参数列表中,并在报告中启用外部图像:
paramList.Add(watermarkParameter);
overTimeReport.EnableExternalImages = true;