com.aspose.words

Class HeaderFooterType

  • java.lang.Object
    • com.aspose.words.HeaderFooterType
public class HeaderFooterType 
extends java.lang.Object

Utility class containing constants. Identifies the type of header or footer found in a Word file.
This is a per section header/footer. Do not renumber as the value of the enum used as an index into plcfhdd.

Example:

Shows how to create headers and footers in a document using DocumentBuilder.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Specify that we want different headers and footers for first, even and odd pages.
builder.getPageSetup().setDifferentFirstPageHeaderFooter(true);
builder.getPageSetup().setOddAndEvenPagesHeaderFooter(true);

// Create the headers, then add three pages to the document to display each header type.
builder.moveToHeaderFooter(HeaderFooterType.HEADER_FIRST);
builder.write("Header for the first page");
builder.moveToHeaderFooter(HeaderFooterType.HEADER_EVEN);
builder.write("Header for even pages");
builder.moveToHeaderFooter(HeaderFooterType.HEADER_PRIMARY);
builder.write("Header for all other pages");

builder.moveToSection(0);
builder.writeln("Page1");
builder.insertBreak(BreakType.PAGE_BREAK);
builder.writeln("Page2");
builder.insertBreak(BreakType.PAGE_BREAK);
builder.writeln("Page3");

doc.save(getArtifactsDir() + "DocumentBuilder.HeadersAndFooters.docx");

Field Summary
static final intHEADER_EVEN = 0
Header for even numbered pages.
static final intHEADER_PRIMARY = 1
Primary header, also used for odd numbered pages.
static final intFOOTER_EVEN = 2
Footer for even numbered pages.
static final intFOOTER_PRIMARY = 3
Primary footer, also used for odd numbered pages.
static final intHEADER_FIRST = 4
Header for the first page of the section.
static final intFOOTER_FIRST = 5
Footer for the first page of the section.
 

    • Field Detail

      • HEADER_EVEN = 0

        public static final int HEADER_EVEN
        Header for even numbered pages.
      • HEADER_PRIMARY = 1

        public static final int HEADER_PRIMARY
        Primary header, also used for odd numbered pages.
      • FOOTER_EVEN = 2

        public static final int FOOTER_EVEN
        Footer for even numbered pages.
      • FOOTER_PRIMARY = 3

        public static final int FOOTER_PRIMARY
        Primary footer, also used for odd numbered pages.
      • HEADER_FIRST = 4

        public static final int HEADER_FIRST
        Header for the first page of the section.
      • FOOTER_FIRST = 5

        public static final int FOOTER_FIRST
        Footer for the first page of the section.