HeaderFooter Class

Header Footer Settings.When the object is serialized out as xml, its qualified name is x:headerFooter.

Namespace:  DocumentFormat.OpenXml.Spreadsheet
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

[ChildElementInfoAttribute(typeof(OddFooter))]
[ChildElementInfoAttribute(typeof(OddHeader))]
[ChildElementInfoAttribute(typeof(EvenFooter))]
[ChildElementInfoAttribute(typeof(FirstFooter))]
[ChildElementInfoAttribute(typeof(EvenHeader))]
[ChildElementInfoAttribute(typeof(FirstHeader))]
public class HeaderFooter : OpenXmlCompositeElement

The following table lists the possible child types:

  • OddHeader <x:oddHeader>

  • OddFooter <x:oddFooter>

  • EvenHeader <x:evenHeader>

  • EvenFooter <x:evenFooter>

  • FirstHeader <x:firstHeader>

  • FirstFooter <x:firstFooter>


[ISO/IEC 29500-1 1st Edition]

18.3.1.46 headerFooter (Header Footer Settings)

Header and footer settings.

[Example:

This example demonstrates "Header" at the top and "Footer" at the bottom of a page.


<headerFooter>
<oddHeader>&amp;CHeader</oddHeader>
<oddFooter>&amp;CFooter</oddFooter>
</headerFooter>


end example]

The tokens in the header & footer elements can be localized. An application can decide which locales are supported. Even when a locale is not supported, the header and footer text shall be loaded, and only the formatting is discarded.

Parent Elements

chartsheet (§18.3.1.12); customSheetView (§18.3.1.24); customSheetView (§18.3.1.25); dialogsheet (§18.3.1.34); worksheet (§18.3.1.99)

Child Elements

Subclause

evenFooter (Even Page Footer)

§18.3.1.38

evenHeader (Even Page Header)

§18.3.1.39

firstFooter (First Page Footer)

§18.3.1.41

firstHeader (First Page Header)

§18.3.1.42

oddFooter (Odd Page Footer)

§18.3.1.57

oddHeader (Odd Header)

§18.3.1.58

Attributes

Description

alignWithMargins (Align Margins)

Align header footer margins with page margins. When true, as left/right margins grow and shrink, the header and footer edges stay aligned with the margins. When false, headers and footers are aligned on the paper edges, regardless of margins.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

differentFirst (Different First Page)

Different first page header and footer. When true then firstHeader and firstFooter specify first page header and footer values. If false and firstHeader / firstFooter are present, they are ignored.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

differentOddEven (Different Odd Even Header Footer)

Different odd and even page headers and footers. When true then oddHeader / oddFooter and evenHeader / evenFooter specify page header and footer values for odd and even pages. If false then oddHeader / oddFooter is used, even when evenHeader / evenFooter are present.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

scaleWithDoc (Scale Header & Footer With Document)

Scale header and footer with document scaling.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

[Note: The W3C XML Schema definition of this element’s content model (CT_HeaderFooter) is located in §A.2. end note]

© ISO/IEC29500: 2008.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show: