Skip to main content
A newer version of this page is available. .

Add a Watermark to a Report

  • 3 minutes to read

This tutorial describes how to add a watermark to a report, and how to use preprinted forms.

add-a-watermark-to-a-report-6

Add a Watermark to a Report

  1. Click the report’s smart tag. Click the Watermark property’s ellipsis button.

    add-a-watermark-to-a-report-0

  2. In the invoked Watermark dialog, select the Text Watermark tab to add a text watermark, or the Picture Watermark tab to add a picture watermark.

    To add a text watermark, specify the text, direction, and font options.

    add-a-watermark-to-a-report-1

    To add a picture watermark, specify an image. Click the Load image option’s Browse button.

    add-a-watermark-to-a-report-2

    In the invoked Select Picture dialog, select the file that contains the watermark image and click Open. Specify the picture’s size and alignment options.

    add-a-watermark-to-a-report-3

    For both textual and picture watermarks, you can adjust the transparency, position (in front of or behind the document content), and the page range within which the watermark is printed.

    Note

    The Transparency property is unavailable when users specify an SVG image.

Use Preprinted Forms

You can show a picture watermark on the report’s body at design time as a preprinted form template.

The image below demonstrates a preprinted form template.

add-a-watermark-to-a-report-5

Add a template image to a report as a watermark image. Set the report’s XtraReport.DrawWatermark property to True in the Properties window.

add-a-watermark-to-a-report-4

add-a-watermark-to-a-report-5

Place report controls on the report’s body according to the preprinted form layout.

add-a-watermark-to-a-report-5a

Add Watermarks in Code

Same Watermark for All Pages

This example demonstrates how to add a watermark to a report. The SetTextWatermark method demonstrates the properties you can use to add a text watermark to a report; the SetPictureWatermark method demonstrates properties required to set a picture as the report’s watermark.

using System.Drawing;
using DevExpress.XtraPrinting;
using DevExpress.XtraPrinting.Drawing;
using DevExpress.Drawing;
// ...
public void SetTextWatermark(XtraReport report) {
    Watermark textWatermark = new Watermark();
    textWatermark.Text = "CUSTOM WATERMARK TEXT";
    textWatermark.TextDirection = DirectionMode.ForwardDiagonal;
    textWatermark.Font = new DXFont(textWatermark.Font.Name, 40);
    textWatermark.ForeColor = Color.DodgerBlue;
    textWatermark.TextTransparency = 150;
    textWatermark.ShowBehind = false;
    textWatermark.PageRange = "1,3-5";
    report.Watermark.CopyFrom(textWatermark);
}
public void SetPictureWatermark(XtraReport report) {
    Watermark pictureWatermark = new Watermark();
    pictureWatermark.ImageSource = ImageSource.FromFile("Watermark.png");
    pictureWatermark.ImageAlign = ContentAlignment.TopCenter;
    pictureWatermark.ImageTiling = false;
    pictureWatermark.ImageViewMode = ImageViewMode.Stretch;
    pictureWatermark.ImageTransparency = 150;
    pictureWatermark.ShowBehind = true;
    pictureWatermark.PageRange = "2,4";
    report.Watermark.CopyFrom(pictureWatermark);
}

Different Watermarks For Different Pages

To specify a unique watermark for different pages in a report, use the Page.AssignWatermark method.

View Example: Reporting for WinForms - How to Add Different Watermarks to Different Pages

Supported Image Formats

A picture watermark supports the following formats:

  • BMP
  • JPG / JPEG / JPE / JFIF
  • GIF
  • TIF / TIFF
  • PNG
  • ICO
  • DIB
  • RLE
  • EMF / WMF
  • SVG

Troubleshooting

Merged Reports

If the main report does not have a watermark, the resulting merged report does not have a watermark either. To solve this problem, add a watermark to individual report pages using the Page.AssignWatermark method.