3. Headers and Footers
• Headers and footers are ‘stories’ in a
WordprocessingML document
• Like the main document story, they can
contain text, graphics or data (such as page
number, date, document title, and so on)
– There is no fundamental restriction to the
contents of the header/footer story
4. Headers and Footers
• What makes these unique is where they are
displayed in page view:
– Headers appear above the top of the main
document story’s text extent
– Footers appear below the bottom of the main
document story’s text extent
• Headers and footers are linked to the main
story as a section-level property in
WordprocessingML
5. Header Part
• Stored in multiple header parts, each of which
has an explicit relationship from the
document part
– The explicit relationship tells the consumer the
section(s) to which a particular header is
anchored
7. Footer Part
• Stored in multiple footer parts, each of which
has an explicit relationship from the
document part
– The explicit relationship tells the consumer the
section(s) to which a particular footer is anchored
9. Using a Header or Footer
• Using headers and footers in
WordprocessingML consists of two parts:
– The section properties (referencing the header)
– The part (the contents of the header)
• Only if both are present is the header or
footer valid
10. Section Properties
• Header or footer parts must be associated
with a section(s) within the document
– Otherwise, they wouldn’t be displayed anywhere
• Each section can contain three types of
headers or footers (declared on the
reference):
– First page – displayed on page one
– Odd page – displayed on pages 1(if no pg
one),3,5,7…
– Even page – displayed on 2,4,6…
11. Section Properties
• The odd page header is the ‘default’ header
– If there’s explicitly no page one header, the odd
page header is displayed there
– If there’s explicitly no even page header, the odd
page header is displayed there
12. Header/Footer References
• References to a header or footer are made via
the headerReference and footerReference
elements
– Each has an attribute with the explicit relationship
ID to the appropriate part
• Saying nothing about each type is slightly
more complicated, though – we’ll come back
to that
14. Headers and Footers
• A WordprocessingML header and footers
consists of one component:
• Content
– Any block-level WordprocessingML content
15. Headers and Footers
• The root element for the header part is the
hdr element
• The root element for the header part is the ftr
element
• Beyond that, this is just another text story
17. Multiple Sections
• Documents can have more than one section
• Each section can define up to three headers
and footers (as seen before)
18. Multiple Sections
• To optimize the output, we only write out
headers and footers when they are different:
• Default (omit a headerReference element):
– Section will inherit the previous header and footer
references
• Override:
– Section specifies header and footer references
19. Multiple Sections
• How do we know which ones to override?
• The header reference tells us the type for
each header – if one is missing, we don’t use
it.
21. Empty Header or Footer
• What if you want an empty header or footer?
– Omitting the reference inherits, so that’s no good.
– To do this, a header or footer reference must be
made to a NULL target
<Relationship
Type=“http://schemas.openxmlformats.org/wordprocessingml/2006/hea
der” target=“NULL” />
Null target part == no
header
22. Disclaimer
This presentation is for informational purposes only, and should
not be relied upon as a substitute or replacement for Microsoft
formal file format documentation, which is available at the
following website: https://msdn.microsoft.com/en-
us/library/cc313118(v=office.12).aspx. Any views or opinions
presented in this material are solely those of the author and do
not necessarily represent those of Microsoft. Microsoft
disclaims all liability for mistakes or inaccuracies in this
presentation.