Progress® Telerik® Reporting R3 2017

Watermarks

Watermarks are text or pictures that appear commingled with the report content. They often add interest or identify status, such as marking a generated report as a Draft. You can see watermarks in Print Preview Layout of the report viewers and when printing or exporting. You have the ability to set the Opacity of the text or image, specify its Position and whether it is displayed on first (PrintOnFirstPage) and last page (PrintOnLastPage).

Watermarks are PageSettings member, processed during the paging of the report. At this moment the report data source is not available anymore, and thus data fields used in expressions would not be evaluated.

Add Text Watermark using Report Designer

To add Text Watermarks to the Report use the following steps:

  1. Open a report in Design view.

  2. You can open the Watermarks collection editor in two ways:

    • Click the Report selector button located in the upper left corner of the Visual Studio Report Designer. This makes the report active in the Properties window. Expand PageSettings and click Watermarks ellipsis in the property grid.

    • Select the Watermarks item in the report's context menu, which appears when you right-click on the designer surface.

    Both actions will display the Watermarks collection editor, which is empty by default.

  3. Click Add button and select TextWatermark.

  4. In Text, type or click the ellipsis to enter text or an Expressions that represents the Text Watermark.

  5. Format the text by setting Color and Font attributes.

  6. Set Opacity.

  7. Set Position. Available options are Behind and Front. Default is Behind.

  8. Set Orientation. Available options are Horizontal, Vertical and Diagonal. Default is Horizontal.

  9. Specify whether it will be displayed on first (PrintOnFirstPage) and last page (PrintOnLastPage).

  10. Click OK.

Add Text Watermark programatically

Telerik.Reporting.Drawing.TextWatermark textWatermark1 = new Telerik.Reporting.Drawing.TextWatermark();
textWatermark1.Color = System.Drawing.Color.Red;
textWatermark1.Font.Bold = true;
textWatermark1.Font.Italic = false;
textWatermark1.Font.Name = "Arial";
textWatermark1.Font.Size = Telerik.Reporting.Drawing.Unit.Point(10D);
textWatermark1.Font.Strikeout = false;
textWatermark1.Font.Underline = false;
textWatermark1.Orientation = Telerik.Reporting.Drawing.WatermarkOrientation.Diagonal;
textWatermark1.Position = Telerik.Reporting.Drawing.WatermarkPosition.Behind;
textWatermark1.PrintOnFirstPage = true;
textWatermark1.PrintOnLastPage = true;
textWatermark1.Text = "My Test Watermark";
textWatermark1.Opacity = 0.3D;
report1.PageSettings.Watermarks.Add(textWatermark1);

Add Picture Watermark using Report Designer

To add Picture Watermarks to the Report use the following steps:

  1. Open a report in Design view.

  2. You can open the Watermarks collection editor in two ways:

    • Click the Report selector button located in the upper left corner of the Visual Studio Report Designer. This makes the report active in the Properties window. Expand PageSettings and click Watermarks ellipsis in the property grid.

    • Select the Watermarks item in the report's context menu, which appears when you right-click on the designer surface.

    Both actions will display the Watermarks collection editor, which is empty by default.

  3. Click the small arrow on the right side of the Add button and select PictureWatermark from the dropdown menu.

  4. In Image, browse for an image file on your hard drive, input an URI (local path or Url) or an Expressions that evaluates to an image.

  5. Set Sizing mode. Available options are Normal, Stretch and ScaleProportional. See PictureBox article for more information on the modes.

  6. Set Opacity.

  7. Set Position. Available options are Behind and Front. Default is Behind.

  8. Specify whether it will be displayed on first (PrintOnFirstPage) and last page (PrintOnLastPage).

  9. Click OK.

Add Picture Watermark programatically

Telerik.Reporting.Drawing.PictureWatermark pictureWatermark1 = new Telerik.Reporting.Drawing.PictureWatermark();
pictureWatermark1.Image = "http://www.telerik.com/images/reporting/cars/NSXGT_7.jpg";
pictureWatermark1.Position = Telerik.Reporting.Drawing.WatermarkPosition.Behind;
pictureWatermark1.PrintOnFirstPage = true;
pictureWatermark1.PrintOnLastPage = true;
pictureWatermark1.Sizing = Telerik.Reporting.Drawing.WatermarkSizeMode.ScaleProportional;
pictureWatermark1.Opacity = 0.5D;
report1.PageSettings.Watermarks.Add(pictureWatermark1);

Add Watermark conditionally

Add Watermarks to the Report on even pages only:

  • For Text Watermark, in Text property, use the following expression: =IIF(PageNumber %2 = 0, "My Text Watermark", null)

  • For Picture Watermark, in Image property, use the following expression: =IIF(PageNumber %2 = 0, "C:\MyImageWatermark.png", null)

Add Watermarks to the Report via defined page range:

  • For Text Watermark, in Text property, use the following expression: =IIF(PageNumber > 2 and PageNumber < 10, "My Text Watermark", null)

  • For Picture Watermark, in Image property, use the following expression: =IIF(PageNumber > 2 and PageNumber < 10, "C:\MyImageWatermark.png", null)

Design-time support

For better design experience, the watermarks are shown in the designer by default. They can be switched on/off with the watermarks button, located on the toolstrip at the bottom left corner of the designer window.

report-designer-toolstrip-watermarks-focused

The value of the text watermarks is not evaluated and it is shown 'as-is' in the designer. Note that the position of the watermark in design-time is calculated based on the report size in designer and might differ from the watermark you will see in the previewed report.

The value of the picture watermark is evaluated against the designer context and will be shown if possible.

Caution note Caution

Some formats do not support Watermarks. For more information refer to the articles in the Design Considerations for Report Rendering section