I have been trying for ages but no matter what combination of alignments I use I cannot get the watermark text to vertically align to Left Margin of the document. Does anyone have some sample code on how to do this?
Many Thanks James
thanks for the reply. A sample word document is attached showing where I how I would like the watermark to be aligned.
Many thanks, James
/// Inserts a watermark into a document.
/// The input document.
/// Text of the watermark.
private static void InsertWatermarkText(Document doc, string watermarkText)
// Create a watermark shape. This will be a WordArt shape.
// You are free to try other shape types as watermarks.
Shape watermark = new Shape(doc, ShapeType.TextPlainText);
// Set up the text of the watermark.
watermark.TextPath.Text = watermarkText;
watermark.TextPath.FontFamily = "Arial";
watermark.Height = 22;
watermark.Width = 471;
// Text will be directed from the bottom to the top.
watermark.Rotation = 270;
watermark.Fill.Color = Color.Red;
watermark.StrokeColor = Color.Red;
watermark.Left = -205.8;
watermark.Top = 399;
watermark.RelativeHorizontalPosition = RelativeHorizontalPosition.LeftMargin;
watermark.RelativeVerticalPosition = RelativeVerticalPosition.Page;
watermark.WrapType = WrapType.None;
// Create a new paragraph and append the watermark to this paragraph.
Paragraph watermarkPara = new Paragraph(doc);
// Insert the watermark into all headers of each document section.
foreach (Section sect in doc.Sections)
// There could be up to three different headers in each section, since we want
// the watermark to appear on all pages, insert into all headers.
InsertWatermarkIntoHeader(watermarkPara, sect, HeaderFooterType.HeaderPrimary);
InsertWatermarkIntoHeader(watermarkPara, sect, HeaderFooterType.HeaderFirst);
InsertWatermarkIntoHeader(watermarkPara, sect, HeaderFooterType.HeaderEven);
private static void InsertWatermarkIntoHeader(Paragraph watermarkPara, Section sect, HeaderFooterType headerType)
HeaderFooter header = sect.HeadersFooters[headerType];
if (header == null)
// There is no header of the specified type in the current section, create it.
header = new HeaderFooter(sect.Document, headerType);
// Insert a clone of the watermark into the header.
many thanks for that, it works a treat.