OfficeIMO

API Reference

Class

WordWatermark

Namespace OfficeIMO.Word
Assembly OfficeIMO.Word

Represents a watermark element within a Word document.

Inheritance

Constructors

WordWatermark 3 overloads
public WordWatermark(WordDocument wordDocument, WordSection wordSection, WordWatermarkStyle style, String textOrFilePath, Nullable<Double> horizontalOffset = null, Nullable<Double> verticalOffset = null, Double scale = 1) #

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

Parameters

wordDocument OfficeIMO.Word.WordDocument requiredposition: 0
The parent document.
wordSection OfficeIMO.Word.WordSection requiredposition: 1
The section to which the watermark should be added.
style OfficeIMO.Word.WordWatermarkStyle requiredposition: 2
The type of watermark to add.
textOrFilePath System.String requiredposition: 3
Text to use or path to the watermark image.
horizontalOffset System.Nullable{System.Double} = null optionalposition: 4
Horizontal offset in points.
verticalOffset System.Nullable{System.Double} = null optionalposition: 5
Vertical offset in points.
scale System.Double = 1 optionalposition: 6
Scale factor for width and height.
public WordWatermark(WordDocument wordDocument, WordSection wordSection, WordHeader wordHeader, WordWatermarkStyle style, String textOrFilePath, Nullable<Double> horizontalOffset = null, Nullable<Double> verticalOffset = null, Double scale = 1) #

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

Parameters

wordDocument OfficeIMO.Word.WordDocument requiredposition: 0
The parent document.
wordSection OfficeIMO.Word.WordSection requiredposition: 1
The section associated with the header.
wordHeader OfficeIMO.Word.WordHeader requiredposition: 2
The header where the watermark will be placed.
style OfficeIMO.Word.WordWatermarkStyle requiredposition: 3
The type of watermark to add.
textOrFilePath System.String requiredposition: 4
Text to use or path to the watermark image.
horizontalOffset System.Nullable{System.Double} = null optionalposition: 5
Horizontal offset in points.
verticalOffset System.Nullable{System.Double} = null optionalposition: 6
Vertical offset in points.
scale System.Double = 1 optionalposition: 7
Scale factor for width and height.
public WordWatermark(WordDocument wordDocument, SdtBlock sdtBlock) #

Initializes a new instance of the WordWatermark class from an existing structured document tag.

Parameters

wordDocument OfficeIMO.Word.WordDocument requiredposition: 0
The parent document.
sdtBlock DocumentFormat.OpenXml.Wordprocessing.SdtBlock requiredposition: 1
The structured document tag block representing the watermark.

Methods

public Void Remove() #
Returns: Void

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 Nullable<Int32> Rotation { get; set; } #

Get or set rotation of the watermark.

public Nullable<Double> Width { get; set; } #

Gets or sets the width of the watermark in points.

public Nullable<Double> Height { get; set; } #

Gets or sets the height of the watermark in points.

public Nullable<Double> HorizontalOffset { get; set; } #

Horizontal offset (margin-left) of the watermark in points.

public Nullable<Double> VerticalOffset { get; set; } #

Vertical offset (margin-top) of the watermark in points.

public String FontFamily { get; set; } #

Font family used for text watermark.

public Nullable<Double> FontSize { get; set; } #

Font size of text watermark in points.

public Nullable<Double> Opacity { get; set; } #

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

public Boolean Stroked { get; set; } #

Get or Set if watermark is stroked.

public Nullable<Boolean> AllowInCell { get; set; } #

Get or Set if watermark is allowed in cell.

public Nullable<Color> 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.

public String ColorHex { get; set; } #

Gets or sets the fill color of the watermark. The value can be a named color (e.g., "red") or a three- or six-digit hex value with or without the leading '#'. Three-digit hex values are expanded to six digits. Invalid inputs will throw ArgumentException.