将所有图像添加到所需部分,然后 EnableSuppress 并将公式设置为在其不在所需页面上时隐藏。
CrystalDecisions.ReportAppServer.ReportDefModel.PictureObject pic=ctl.ReportObjectController.ImportPicture(tempImagePath, s, 0, 0);
if (pic != null)
{
var picNew = pic.Clone();
picNew.Format.EnableSuppress = true;
CrystalDecisions.ReportAppServer.ReportDefModel.ConditionFormula f = roNew.Format.ConditionFormulas[CrObjectFormatConditionFormulaTypeEnum.crObjectFormatConditionFormulaTypeEnableSuppress];
if (f != null)
{
f.Syntax = CrFormulaSyntaxEnum.crFormulaSyntaxCrystal;
f.Text = string.Format("PageNumber <> {0}", ri.PageNumber);
}
ctl.ReportObjectController.Modify(pic, picNew);
}