Skip to main content
All docs
V23.2

WatermarkFormat.ImageOptions Property

Returns options for the image watermark.

Namespace: DevExpress.XtraRichEdit.API.Native

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

NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation

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