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.
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.
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.
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.
Document doc = app.Create(); Watermark mark = doc.Watermark; mark.ClearWatermark(); |