Click or drag to resize

HeaderFooterType Enumeration

Identifies the type of header or footer found in a Word file.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.2
Syntax
public enum HeaderFooterType
Members
  Member nameValueDescription
HeaderEven0 Header for even numbered pages.
HeaderPrimary1 Primary header, also used for odd numbered pages.
FooterEven2 Footer for even numbered pages.
FooterPrimary3 Primary footer, also used for odd numbered pages.
HeaderFirst4 Header for the first page of the section.
FooterFirst5 Footer for the first page of the section.
Examples
Creates headers and footers in a document using DocumentBuilder.
// Create a blank document
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Specify that we want headers and footers different for first, even and odd pages
builder.PageSetup.DifferentFirstPageHeaderFooter = true;
builder.PageSetup.OddAndEvenPagesHeaderFooter = true;

// Create the headers
builder.MoveToHeaderFooter(HeaderFooterType.HeaderFirst);
builder.Write("Header First");
builder.MoveToHeaderFooter(HeaderFooterType.HeaderEven);
builder.Write("Header Even");
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
builder.Write("Header Odd");

// Create three pages in the document
builder.MoveToSection(0);
builder.Writeln("Page1");
builder.InsertBreak(BreakType.PageBreak);
builder.Writeln("Page2");
builder.InsertBreak(BreakType.PageBreak);
builder.Writeln("Page3");

doc.Save(ArtifactsDir + "DocumentBuilder.HeadersAndFooters.doc");
See Also