Hiding page BackPicture via code

Hi all.
I'm trying to replicate a watermarking functionality for reports by showing/hiding the page's BackPicture. I need to access the page object via delphi code and toggle visibility flags.
I have tried the following methods but neither seems to be working:
  report_page := FormReport.frxReportLoader.FindObject('Page1') as TfrxReportPage;
  if report_page <> nil then
	begin
	  report_page.BackPicture.Assign(nil);
	end;
	report_page := FormReport.frxReportLoader.FindObject('Page1') as TfrxReportPage;
	if report_page <> nil then
	begin
	  report_page.BackPictureVisible := False;
	  report_page.BackPicturePrintable := False;
	end;


Thank you.

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 9:01AM
    Have you loaded the report into the tfrxreport component first before trying to modify it?
  • edited 9:01AM
    gordk wrote: »
    Have you loaded the report into the tfrxreport component first before trying to modify it?

    Yes.
    Report operations are done in the following order (batch print):

    1. load fr3 file
    2. show/hide backpicture
    3. prepare report
    4. show report
  • edited 9:01AM
    Update on the issue:

    this works
    report_page := TfrxReportPage(FormReport.frxReportLoader.FindObject('Page1'));
    

    this doesn't
    report_page := FormReport.frxReportLoader.FindObject('Page1') as TfrxReportPage;
    

Leave a Comment