Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

...

...

A watermark is an image or text that when printed appears in the background of a document. The watermark text or image is faded so that it does not distract from the content of the document but is legible.

 

The property Document.Watermark returns a Watermark object.

Code Block
c#
c#

WordApplication app = new WordApplication();
Document doc = app.Create();
Watermark mark = doc.Watermark;

To create a text watermark, assign the string that you want to display in the background of the document to the Watermark object's Text property.

Code Block
c#
c#

Watermark mark = doc.Watermark;
mark.Text = "CONFIDENTIAL";
mark.WatermarkLayout = Watermark.Layout.Diagonal;

To use an image as a watermark, assign an image file to the Watermark object's Image property.

Code Block
c#
c#

Watermark mark = doc.Watermark;
mark.Image = File.Open("somepic.gif", FileMode.Open);

To remove a watermark from a document, call the Watermark object's ClearWatermark method.

Code Block
c#
c#

Document doc = app.Create();
Watermark mark = doc.Watermark;
mark.ClearWatermark();