API Reference
WordWatermark
Represents a watermark element within a Word document.
Inheritance
- WordElement
- WordWatermark
Constructors
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
- The parent document.
- wordSection OfficeIMO.Word.WordSection
- The section to which the watermark should be added.
- style OfficeIMO.Word.WordWatermarkStyle
- The type of watermark to add.
- textOrFilePath System.String
- Text to use or path to the watermark image.
- horizontalOffset System.Nullable{System.Double} = null
- Horizontal offset in points.
- verticalOffset System.Nullable{System.Double} = null
- Vertical offset in points.
- scale System.Double = 1
- 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
- The parent document.
- wordSection OfficeIMO.Word.WordSection
- The section associated with the header.
- wordHeader OfficeIMO.Word.WordHeader
- The header where the watermark will be placed.
- style OfficeIMO.Word.WordWatermarkStyle
- The type of watermark to add.
- textOrFilePath System.String
- Text to use or path to the watermark image.
- horizontalOffset System.Nullable{System.Double} = null
- Horizontal offset in points.
- verticalOffset System.Nullable{System.Double} = null
- Vertical offset in points.
- scale System.Double = 1
- 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
- The parent document.
- sdtBlock DocumentFormat.OpenXml.Wordprocessing.SdtBlock
- The structured document tag block representing the watermark.
Methods
public Void Remove() #VoidRemoves this watermark from the document by deleting the structured document tag that stores its content.
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
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.