Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

WatermarkFormat.ImageOptions Property

Returns options for the image watermark.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v24.2.Core.dll

NuGet Package: DevExpress.RichEdit.Core

#Declaration

ImageWatermarkOptions ImageOptions { get; }

#Property Value

Type Description
ImageWatermarkOptions

An object that contains image watermark options.

#Remarks

The ImageOptions property allows you to access and modify image settings for a watermark. You can change the image scale percentage (Scale) and apply or remove the washout effect (Washout).

The example below demonstrates how to change image watermark options. The code iterates through all document sections and updates settings for image watermarks in primary headers. The WatermarkFormat.Type property is used to check the watermark type.

using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;
using System.Drawing;
using System.Linq;
// ...

document.LoadDocument(@"Documents\Watermarks.docx");

// Add an image watermark to the document.
document.WatermarkManager.SetImage(Image.FromFile(@"Images\DevExpressLogo.png"));

foreach (Section section in document.Sections)
{
    // Obtain the section's primary header.
    SubDocument headerContent = section.BeginUpdateHeader();
    // Retrieve the header's watermark.
    Shape watermark = headerContent.Shapes.SingleOrDefault(x => x.Type == ShapeType.Watermark);
    // Change watermark image options.
    if (watermark != null && watermark.WatermarkFormat.Type == WatermarkType.Image)
    {
        watermark.WatermarkFormat.ImageOptions.Washout = false;
        watermark.WatermarkFormat.ImageOptions.Scale = 3;
        watermark.RotationAngle = -45;
    }
    section.EndUpdateHeader(headerContent);
}
document.SaveDocument(@"Documents\WatermarksUpd.docx", DocumentFormat.OpenXml);

The following image demonstrates the result:

Image Watermarks

See Also