Aspose.Words.Examples.CSharp.Programming_Documents.Working_with_Images.AddWatermark.InsertWatermarkIntoHeader C# (CSharp) Method

InsertWatermarkIntoHeader() private static method

private static InsertWatermarkIntoHeader ( Paragraph watermarkPara, Section sect, HeaderFooterType headerType ) : void
watermarkPara Paragraph
sect Section
headerType HeaderFooterType
return void
        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);
                sect.HeadersFooters.Add(header);
            }

            // Insert a clone of the watermark into the header.
            header.AppendChild(watermarkPara.Clone(true));
        }
    }