Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

WordWatermark

OfficeIMO.Word

Namespace
OfficeIMO.Word
Assembly
OfficeIMO.Word
Source revision
0eef6a5756b9 with working tree changes

Represents a watermark element within a Word document.

Inheritance

Usage

Explore 7 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Constructors

WordWatermark 2 overloads
public WordWatermark(WordDocument wordDocument, WordSection wordSection, WordWatermarkStyle style, string textOrFilePath, OfficeLength? horizontalOffset = null, OfficeLength? verticalOffset = null, double scale = 1) #

Initializes a new instance of the WordWatermark class for the specified section.

Parameters

wordDocument OfficeIMO.Word.WordDocument required
The parent document.
wordSection OfficeIMO.Word.WordSection required
The section to which the watermark should be added.
style OfficeIMO.Word.WordWatermarkStyle required
The type of watermark to add.
textOrFilePath string required
Text to use or path to the watermark image.
horizontalOffset OfficeIMO.OfficeLength? = null optional
Optional signed horizontal offset.
verticalOffset OfficeIMO.OfficeLength? = null optional
Optional signed vertical offset.
scale double = 1 optional
Scale factor for width and height.
public WordWatermark(WordDocument wordDocument, WordSection wordSection, WordHeader wordHeader, WordWatermarkStyle style, string textOrFilePath, OfficeLength? horizontalOffset = null, OfficeLength? verticalOffset = null, double scale = 1) #

Initializes a new instance of the WordWatermark class for the specified header.

Parameters

wordDocument OfficeIMO.Word.WordDocument required
The parent document.
wordSection OfficeIMO.Word.WordSection required
The section associated with the header.
wordHeader OfficeIMO.Word.WordHeader required
The header where the watermark will be placed.
style OfficeIMO.Word.WordWatermarkStyle required
The type of watermark to add.
textOrFilePath string required
Text to use or path to the watermark image.
horizontalOffset OfficeIMO.OfficeLength? = null optional
Optional signed horizontal offset.
verticalOffset OfficeIMO.OfficeLength? = null optional
Optional signed vertical offset.
scale double = 1 optional
Scale factor for width and height.

Methods

public void Remove() #

Removes this watermark from the document by deleting the structured document tag that stores its content.

Properties

public string Text { get; set; } #

Gets or sets the watermark text.

public int? Rotation { get; set; } #

Get or set rotation of the watermark.

public OfficeLength? Width { get; set; } #

Gets or sets the physical watermark width. Null removes the stored width.

public OfficeLength? Height { get; set; } #

Gets or sets the physical watermark height. Null removes the stored height.

public OfficeLength? HorizontalOffset { get; set; } #

Gets or sets the signed horizontal offset. Null removes the stored margin-left.

public OfficeLength? VerticalOffset { get; set; } #

Gets or sets the signed vertical offset. Null removes the stored margin-top.

public string? FontFamily { get; set; } #

Font family used for text watermark.

public OfficeLength? FontSize { get; set; } #

Font size of text watermark in points.

public double? Opacity { get; set; } #

Opacity of the watermark fill. Value should be between 0 and 1.

public bool Stroked { get; set; } #

Get or Set if watermark is stroked.

public bool? AllowInCell { get; set; } #

Get or Set if watermark is allowed in cell.

public OfficeColor? Color { get; set; } #

Gets or sets color of the watermark. Accepted formats for setting the color are named colors (for example, "red") or three- or six-digit hexadecimal strings with or without a leading '#'. Invalid color values will result in ArgumentException being thrown.