<headerReference> (Header Reference)

This element specifies a single header which shall be associated with the current section in the document. This header shall be referenced via the @id attribute, which specifies an explicit relationship to the appropriate Header part in the WordprocessingML package.

If the relationship type of the relationship specified by this element is not http://schemas.openxmlformats.org/officeDocument/2006/header, is not present, or does not have a @TargetMode attribute value of Internal, then the document shall be considered non-conformant.

Within each section of a document there may be up to three different types of headers:

  • First page header

  • Odd page header

  • Even page header

The header type specified by the current <headerReference> is specified via the @type attribute.

If any type of header is omitted for a given section, then the following rules shall apply.

  • If no <headerReference> for the first page header is specified and the <titlePg> element is specified, then the first page header shall be inherited from the previous section or, if this is the first section in the document, a new blank header shall be created. If the <titlePg> element is not specified, then no first page header shall be shown, and the odd page header shall be used in its place.

  • If no <headerReference> for the even page header is specified and the <evenAndOddHeaders> element is specified, then the even page header shall be inherited from the previous section or, if this is the first section in the document, a new blank header shall be created. If the< evenAndOddHeaders> element is not specified, then no even page header shall be shown, and the odd page header shall be used in its place.

  • If no <headerReference> for the odd page header is specified then the even page header shall be inherited from the previous section or, if this is the first section in the document, a new blank header shall be created.

example:

This document defines three headers, each of have a relationship from the document part with a unique relationship ID, as shown in the following packaging markup:

<Relationships xmlns=http://schemas.openxmlformats.org/package/2006/relationships>
  …
  <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" Target="header1.xml" />
  <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" Target="header2.xml" />
  <Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" Target="header3.xml" /></Relationships>

These relationships are then referenced in the section's properties using the following WordprocessingML:

<w:sectPr><w:headerReference r:id="rId3" w:type="first" />
  <w:headerReference r:id="rId5" w:type="default" />
  <w:headerReference r:id="rId2" w:type="even" /></w:sectPr>

The resulting section shall use the header part with relationship id rId3 for the first page, the header part with relationship id rId2 for all subsequent even pages, and the header part with relationship id rId5 for all subsequent odd pages. ]

Parent Elements

<sectPr>2.6.18); <sectPr>2.6.19)

Attributes

Description

<id> (Relationship to Part)

Namespace: .../officeDocument/2006/relationships

Specifies the relationship ID to a specified part.

The specified relationship shall match the type required by the parent element:

  • http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer for the <footerReference> element

  • http://schemas.openxmlformats.org/officeDocument/2006/relationships/header for the <headerReference> element

  • http://schemas.openxmlformats.org/officeDocument/2006/relationships/font for the <embedBold>, <embedBoldItalic>, <embedItalic>, or< embedRegular> elements

  • http://schemas.openxmlformats.org/officeDocument/2006/relationships/printerSettings for the <printerSettings> element

<… r:id="rId10" />

The markup specifies the associated relationship part with relationship ID rId1 contains the corresponding relationship information for the parent XML element. ]

The possible values for this attribute are defined by the ST_RelationshipId simple type (§7.8.2.1).

<type> (Header or Footer Type)

Specifies the type of header or footer specified by the target relationship ID. This type determines the page(s) on which the current header or footer shall be displayed.

If any section contains more than a single header or footer of each type, then the document shall be considered non-conformant.

<w:sectPr><w:footerReference r:id="rId6" w:type="first" />
  <w:footerReference r:id="rId7" w:type="first" />
  <w:footerReference r:id="rId10" w:type="even" /></w:sectPr>

The resulting section has two footers of type first, and therefore is invalid. ]

<w:headerReference r:id="rId10" w:type="first" />

The resulting section shall use the specified header part for the first page. ]

The possible values for this attribute are defined by the ST_HdrFtr simple type (§2.18.41).

The following XML Schema fragment defines the contents of this element:

<complexType name="CT_HdrFtrRef">
	<complexContent>
	<extension base="CT_Rel">
	<attribute name="type" type="ST_HdrFtr" use="required"/>
	</extension>
	</complexContent>
</complexType>