WatermarkFormat.TextOptions Property
Returns options for the text watermark.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v24.2.Core.dll
NuGet Package: DevExpress.RichEdit.Core
Declaration
Property Value
Type | Description |
---|---|
TextWatermarkOptions | An object that contains text watermark options. |
Remarks
The TextOptions property allows you to access and modify text settings (font attributes, text color, and layout) for a watermark.
The example below demonstrates how to change text watermark options. The code iterates through all document sections and updates settings for text 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 a text watermark to the document.
document.WatermarkManager.SetText("CONFIDENTIAL");
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 text watermark options.
if (watermark != null && watermark.WatermarkFormat.Type == WatermarkType.Text)
{
watermark.WatermarkFormat.TextOptions.Color = Color.SlateGray;
watermark.WatermarkFormat.TextOptions.FontFamily = "Segoe UI";
watermark.WatermarkFormat.TextOptions.Layout = WatermarkLayout.Horizontal;
watermark.WatermarkFormat.TextOptions.Semitransparent = true;
}
section.EndUpdateHeader(headerContent);
}
document.SaveDocument(@"Documents\WatermarksUpd.docx", DocumentFormat.OpenXml);
The following image demonstrates the result:
See Also