w:ftr (Footer)
Root element of a footer part (footer1.xml etc.), containing block-level content rendered in the page footer area.
Description
w:ftr is the root element of a footer part (footer{n}.xml). It is defined in ECMA-376 Part 1 §17.10.2.
The footer part is a separate XML file linked from the main document via a w:footerReference relationship. Like w:hdr, it may contain paragraphs and tables, and must contain at least one paragraph. Page number fields (PAGE, NUMPAGES) are commonly placed in footer paragraphs.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
| (none) | — | — | Content is expressed entirely via child paragraphs and tables. |
Examples
<!-- footer1.xml: centred page number -->
<w:ftr xmlns:w="...">
<w:p>
<w:pPr>
<w:jc w:val="center"/>
</w:pPr>
<w:r>
<w:fldChar w:fldCharType="begin"/>
</w:r>
<w:r>
<w:instrText> PAGE </w:instrText>
</w:r>
<w:r>
<w:fldChar w:fldCharType="end"/>
</w:r>
</w:p>
</w:ftr>
var footerPart = mainPart.AddNewPart<FooterPart>();
footerPart.Footer = new Footer(
new Paragraph(
new ParagraphProperties(new Justification { Val = JustificationValues.Center }),
new Run(new FieldChar { FieldCharType = FieldCharValues.Begin }),
new Run(new FieldCode(" PAGE ")),
new Run(new FieldChar { FieldCharType = FieldCharValues.End })));