'Word Interop C# - Positioning Watermark in Header

I'm automating a process of applying watermarks in Word documents, the watermark text will be conditionally set.

I've come across an issue when placing a watermark in a header that contains a table. The position of the watermark is pushed to the top of the page despite setting the paragraph (after the table) as the anchor for the shape.

See code snippet below:

foreach (Word.HeaderFooter header in section.Headers)
{
    if (header.Exists)
    {
          Word.Shape logoWatermark = null;
          if (header.Range.Tables.Count > 0)
          {
                Word.Paragraph para = header.Range.Paragraphs.Last;
                logoWatermark = header.Shapes.AddTextEffect(Office.MsoPresetTextEffect.msoTextEffect1, 
                                "Hello World", "Arial", (float)75, Office.MsoTriState.msoFalse, 
                                office.MsoTriState.msoFalse, 0, 0, para.Range);
          }
          else
          {
                logoWatermark = header.Shapes.AddTextEffect(Office.MsoPresetTextEffect.msoTextEffect1, 
                                "Hello World", "Arial", (float)75, Office.MsoTriState.msoFalse, 
                                Office.MsoTriState.msoFalse, 0, 0);
          }
          
          ***Omitted Code***

          logoWatermark.RelativeHorizontalPosition = Word.WdRelativeHorizontalPosition.wdRelativeHorizontalPositionPage;
          logoWatermark.RelativeVerticalPosition = Word.WdRelativeVerticalPosition.wdRelativeVerticalPositionPage;
          logoWatermark.Left = (float)Word.WdShapePosition.wdShapeCenter;
          logoWatermark.Top = (float)Word.WdShapePosition.wdShapeCenter;
          logoWatermark.Rotation = -40;
          logoWatermark.WrapFormat.Type = Word.WdWrapType.wdWrapBehind;
          }
     }
}

The documentation of the AddTextEffect methods describes the optional parameter of an range object. however it seems to be ignoring this paramter and placing the WordArt at the top left of the page.

I would very much appreciate any help or pointers to overcome this problem.

Expected result:

enter image description here

Actual result:

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source