## org.apache.poi.xwpf.model
Class XWPFHeaderFooterPolicy

    java.lang.Object
      org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy

    public class XWPFHeaderFooterPolicy

extends java.lang.Object

A .docx file can have no headers/footers, the same header/footer on each page, odd/even page footers, and optionally also a different header/footer on the first page. This class handles sorting out what there is, and giving you the right headers and footers for the document.

Field Summary
`static org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr.Enum` `DEFAULT`
`static org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr.Enum` `EVEN`
`static org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr.Enum` `FIRST`

Constructor Summary
`XWPFHeaderFooterPolicy(XWPFDocument doc)` Figures out the policy for the given document, and creates any header and footer objects as required.
`XWPFHeaderFooterPolicy(XWPFDocument doc, org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSectPr sectPr)` Figures out the policy for the given document, and creates any header and footer objects as required.

Method Summary
`XWPFFooter` `createFooter(org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr.Enum type)`
`XWPFFooter` `createFooter(org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr.Enum type, XWPFParagraph[] pars)`
`XWPFHeader` `createHeader(org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr.Enum type)`
`XWPFHeader` `createHeader(org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr.Enum type, XWPFParagraph[] pars)`
`void` `createWatermark(java.lang.String text)`
`XWPFFooter` `getDefaultFooter()`
`XWPFHeader` `getDefaultHeader()`
`XWPFFooter` `getEvenPageFooter()`
`XWPFHeader` `getEvenPageHeader()`
`XWPFFooter` `getFirstPageFooter()`
`XWPFHeader` `getFirstPageHeader()`
`XWPFFooter` `getFooter(int pageNumber)` Get the footer that applies to the given (1 based) page.
`XWPFHeader` `getHeader(int pageNumber)` Get the header that applies to the given (1 based) page.
`XWPFFooter` `getOddPageFooter()` Returns the odd page footer.
`XWPFHeader` `getOddPageHeader()` Returns the odd page header.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT

    public static final org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr.Enum DEFAULT

### EVEN

    public static final org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr.Enum EVEN

### FIRST

    public static final org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr.Enum FIRST

Constructor Detail

### XWPFHeaderFooterPolicy

    public XWPFHeaderFooterPolicy(XWPFDocument doc)
                           throws java.io.IOException,
                                  org.apache.xmlbeans.XmlException

  Figures out the policy for the given document, and creates any header and footer objects as required.

  Throws:
    `java.io.IOException`
    `org.apache.xmlbeans.XmlException`

### XWPFHeaderFooterPolicy

    public XWPFHeaderFooterPolicy(XWPFDocument doc,
                                  org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSectPr sectPr)
                           throws java.io.IOException,
                                  org.apache.xmlbeans.XmlException

  Figures out the policy for the given document, and creates any header and footer objects as required.

  Throws:
    `java.io.IOException`
    `org.apache.xmlbeans.XmlException`

Method Detail

### createHeader

    public XWPFHeader createHeader(org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr.Enum type)
                            throws java.io.IOException

  Throws:
    `java.io.IOException`

### createHeader

    public XWPFHeader createHeader(org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr.Enum type,
                                   XWPFParagraph[] pars)
                            throws java.io.IOException

  Throws:
    `java.io.IOException`

### createFooter

    public XWPFFooter createFooter(org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr.Enum type)
                            throws java.io.IOException

  Throws:
    `java.io.IOException`

### createFooter

    public XWPFFooter createFooter(org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr.Enum type,
                                   XWPFParagraph[] pars)
                            throws java.io.IOException

  Throws:
    `java.io.IOException`

### getFirstPageHeader

    public XWPFHeader getFirstPageHeader()

### getFirstPageFooter

    public XWPFFooter getFirstPageFooter()

### getOddPageHeader

    public XWPFHeader getOddPageHeader()

  Returns the odd page header. This is also the same as the default one...

### getOddPageFooter

    public XWPFFooter getOddPageFooter()

  Returns the odd page footer. This is also the same as the default one...

### getEvenPageHeader

    public XWPFHeader getEvenPageHeader()

### getEvenPageFooter

    public XWPFFooter getEvenPageFooter()

### getDefaultHeader

    public XWPFHeader getDefaultHeader()

### getDefaultFooter

    public XWPFFooter getDefaultFooter()

### getHeader

    public XWPFHeader getHeader(int pageNumber)

  Get the header that applies to the given (1 based) page.

  Parameters:
    `pageNumber` - The one based page number

### getFooter

    public XWPFFooter getFooter(int pageNumber)

  Get the footer that applies to the given (1 based) page.

  Parameters:
    `pageNumber` - The one based page number

### createWatermark

    public void createWatermark(java.lang.String text)

Copyright 2012 The Apache Software Foundation or its licensors, as applicable.