Set watermark by code in the preview window

Hi, is there a way to change the watermark in the preview window, only by code, without passing through the EditWatermark window?
I've tried cycling the PreparedPages collection and set the watermark for all the pages but without success.
I've tried even cycling the ReportPages and regenerate the report with the RefreshReport method of the Preview window but without success.
Is there a way to realize this?
Thank you.

Comments

  • edited 8:29PM
    Hello,

    This code sets the watermark to all pages and refreshes a report:
          Watermark watermark = new Watermark();
          watermark.Enabled = true;
          watermark.Text = "TEST";
    
          ReportPage page = previewControl1.Report.PreparedPages.GetPage(previewControl1.PageNo - 1);
          ReportPage originalPage = page.OriginalComponent.OriginalComponent as ReportPage;
          originalPage.Watermark = watermark;
          previewControl1.RefreshReport();
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.