HeaderFooterType

Inheritance: java.lang.Object

public class HeaderFooterType

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.

Examples:

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");
 

Fields

FieldDescription
FOOTER_EVENFooter for even numbered pages.
FOOTER_FIRSTFooter for the first page of the section.
FOOTER_PRIMARYPrimary footer, also used for odd numbered pages.
HEADER_EVENHeader for even numbered pages.
HEADER_FIRSTHeader for the first page of the section.
HEADER_PRIMARYPrimary header, also used for odd numbered pages.
length

Methods

MethodDescription
fromName(String headerFooterTypeName)
getName(int headerFooterType)
getValues()
toString(int headerFooterType)
public static int FOOTER_EVEN

Footer for even numbered pages.

public static int FOOTER_FIRST

Footer for the first page of the section.

public static int FOOTER_PRIMARY

Primary footer, also used for odd numbered pages.

HEADER_EVEN

public static int HEADER_EVEN

Header for even numbered pages.

HEADER_FIRST

public static int HEADER_FIRST

Header for the first page of the section.

HEADER_PRIMARY

public static int HEADER_PRIMARY

Primary header, also used for odd numbered pages.

length

public static int length

fromName(String headerFooterTypeName)

public static int fromName(String headerFooterTypeName)

Parameters:

ParameterTypeDescription
headerFooterTypeNamejava.lang.String

Returns: int

getName(int headerFooterType)

public static String getName(int headerFooterType)

Parameters:

ParameterTypeDescription
headerFooterTypeint

Returns: java.lang.String

getValues()

public static int[] getValues()

Returns: int[]

toString(int headerFooterType)

public static String toString(int headerFooterType)

Parameters:

ParameterTypeDescription
headerFooterTypeint

Returns: java.lang.String