We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Adding Watermarks deletes second page header

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.Width = 600;
    watermark.Height = 250;
    watermark.Left = 50;
    watermark.DistanceRight = 200;
    // Text will be directed from the bottom-left to the top-right corner.
    watermark.Rotation = -30;
    // Remove the following two lines if you need a solid black text.
    watermark.Fill.Color = Color.LightGray;
    // Try LightGray to get more Word-style watermark
    watermark.StrokeColor = Color.LightGray;
    // Try LightGray to get more Word-style watermark
    // Place the watermark in the page center.
    watermark.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
    watermark.RelativeVerticalPosition = RelativeVerticalPosition.Page;
    watermark.WrapType = WrapType.None;
    watermark.VerticalAlignment = VerticalAlignment.Center;
    watermark.HorizontalAlignment = HorizontalAlignment.Center;
    // Create a new paragraph and append the watermark to this paragraph.
    Paragraph watermarkPara = new Paragraph(doc);
    //ParagraphCollection paragraphCollection;
    // doc.FirstSection.PageSetup.DifferentFirstPageHeaderFooter = true;
    // 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,
        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.

I am having problem when I am trying to add watermark in my Word File using C#. Please help me I have tried every bit of code.

Hi there,

Thanks for your inquiry. In case you are using an older version of Aspose.Words, I would suggest you please upgrade to the latest version (v14.11.0) from here and let us know how it goes on your side. If the problem still remains, please attach your input Word document here for testing. I will investigate the issue on my side and provide you more information.