Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.xwpf.usermodel
Class XWPFHeaderFooter

    java.lang.Object
      org.apache.poi.POIXMLDocumentPart
          org.apache.poi.xwpf.usermodel.XWPFHeaderFooter

All Implemented Interfaces:
  IBody

Direct Known Subclasses:
  XWPFFooter, XWPFHeader

    public abstract class XWPFHeaderFooter

extends POIXMLDocumentPart
implements IBody

Parent of XWPF headers and footers

Field Summary
`protected java.util.List<IBodyElement>` | `bodyElements`
`protected XWPFDocument` | `document`
`protected org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHdrFtr` | `headerFooter`
`protected java.util.List<XWPFParagraph>` | `paragraphs`
`protected java.util.List<XWPFPictureData>` | `pictures`
`protected java.util.List<XWPFTable>` | `tables`

Fields inherited from class org.apache.poi.POIXMLDocumentPart
`DEFAULT_XML_OPTIONS`

Constructor Summary
`protected` | `XWPFHeaderFooter()`
`protected` | `XWPFHeaderFooter(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHdrFtr hdrFtr)`
`` | `XWPFHeaderFooter(PackagePart part, PackageRelationship rel)`

Method Summary
`org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHdrFtr` | `_getHdrFtr()`
`int` | `addPicture(byte[] pictureData, int format)` Adds a picture to the document.
`int` | `addPicture(java.io.InputStream is, int format)` Adds a picture to the document.
`PackageRelationship` | `addPictureReference(byte[] pictureData, int format)` Add the picture to drawing relations
`PackageRelationship` | `addPictureReference(java.io.InputStream is, int format)` Add the picture to drawing relations
`java.util.List<XWPFPictureData>` | `getAllPackagePictures()` get all Pictures in this package
`java.util.List<XWPFPictureData>` | `getAllPictures()`
`java.util.List<IBodyElement>` | `getBodyElements()` Returns an Iterator with paragraphs and tables, in the order that they occur in the text.
`java.util.List<XWPFParagraph>` | `getListParagraph()` get a List of all Paragraphs
`int` | `getNextPicNameNumber(int format)` get the next free ImageNumber
`POIXMLDocumentPart` | `getOwner()`
`XWPFParagraph` | `getParagraph(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP p)` if there is a corresponding `XWPFParagraph` of the parameter ctTable in the paragraphList of this header or footer the method will return this paragraph if there is no corresponding `XWPFParagraph` the method will return null
`XWPFParagraph` | `getParagraphArray(int pos)` Returns the paragraph that holds the text of the header or footer.
`java.util.List<XWPFParagraph>` | `getParagraphs()` Returns the paragraph(s) that holds the text of the header or footer.
`XWPFPictureData` | `getPictureDataByID(java.lang.String blipID)` returns the PictureData by blipID
`XWPFTable` | `getTable(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl ctTable)` if there is a corresponding `XWPFTable` of the parameter ctTable in the tableList of this header the method will return this table if there is no corresponding `XWPFTable` the method will return null
`XWPFTable` | `getTableArray(int pos)` Returns the table at position pos
`XWPFTableCell` | `getTableCell(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc cell)` get the TableCell which belongs to the TableCell
`java.util.List<XWPFTable>` | `getTables()` Return the table(s) that holds the text of the header or footer, for complex cases where a paragraph isn't used.
`java.lang.String` | `getText()` Returns the textual content of the header/footer, by flattening out the text of its paragraph(s)
`XWPFParagraph` | `insertNewParagraph(org.apache.xmlbeans.XmlCursor cursor)` add a new paragraph at position of the cursor
`XWPFTable` | `insertNewTbl(org.apache.xmlbeans.XmlCursor cursor)` inserts a new Table at the cursor position.
`void` | `insertTable(int pos, XWPFTable table)` inserts an existing XWPFTable to the arrays bodyElements and tables
`void` | `readHdrFtr()`
`void` | `setHeaderFooter(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHdrFtr headerFooter)` set a new headerFooter

Methods inherited from class org.apache.poi.POIXMLDocumentPart
`addRelation, commit, createRelationship, createRelationship, createRelationship, getPackagePart, getPackageRelationship, getParent, getRelations, onDocumentCreate, onDocumentRead, onSave, read, rebase, removeRelation, toString`

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

Methods inherited from interface org.apache.poi.xwpf.usermodel.IBody
`getPart, getPartType`

Field Detail

### headerFooter

    protected org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHdrFtr headerFooter

### paragraphs

    protected java.util.List<XWPFParagraph> paragraphs

### tables

    protected java.util.List<XWPFTable> tables

### pictures

    protected java.util.List<XWPFPictureData> pictures

### document

    protected XWPFDocument document

### bodyElements

    protected java.util.List<IBodyElement> bodyElements

Constructor Detail

### XWPFHeaderFooter

    protected XWPFHeaderFooter(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHdrFtr hdrFtr)

### XWPFHeaderFooter

    protected XWPFHeaderFooter()

### XWPFHeaderFooter

    public XWPFHeaderFooter(PackagePart part,
                            PackageRelationship rel)
                     throws java.io.IOException

Throws:
  `java.io.IOException`

Method Detail

### _getHdrFtr

    @Internal
    public org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHdrFtr _getHdrFtr()

### getBodyElements

    public java.util.List<IBodyElement> getBodyElements()

  Description copied from interface: `IBody`
  Returns an Iterator with paragraphs and tables, in the order that they occur in the text.

  Specified by:
    `getBodyElements` in interface `IBody`

### getParagraphs

    public java.util.List<XWPFParagraph> getParagraphs()

  Returns the paragraph(s) that holds the text of the header or footer. Normally there is only the one paragraph, but there could be more in certain cases, or a table.

  Specified by:
    `getParagraphs` in interface `IBody`

### getTables

    public java.util.List<XWPFTable> getTables()
                                        throws java.lang.ArrayIndexOutOfBoundsException

  Return the table(s) that holds the text of the header or footer, for complex cases where a paragraph isn't used. Normally there's just one paragraph, but some complex headers/footers have a table or two in addition.

  Specified by:
    `getTables` in interface `IBody`
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`

### getText

    public java.lang.String getText()

  Returns the textual content of the header/footer, by flattening out the text of its paragraph(s)

### setHeaderFooter

    public void setHeaderFooter(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHdrFtr headerFooter)

  set a new headerFooter

### getTable

    public XWPFTable getTable(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl ctTable)

  if there is a corresponding `XWPFTable` of the parameter ctTable in the tableList of this header the method will return this table if there is no corresponding `XWPFTable` the method will return null

  Specified by:
    `getTable` in interface `IBody`
  Parameters:
    `ctTable` -

### getParagraph

    public XWPFParagraph getParagraph(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP p)

  if there is a corresponding `XWPFParagraph` of the parameter ctTable in the paragraphList of this header or footer the method will return this paragraph if there is no corresponding `XWPFParagraph` the method will return null

  Specified by:
    `getParagraph` in interface `IBody`
  Parameters:
    `p` - is instance of CTP and is searching for an XWPFParagraph
  Returns:
    null if there is no XWPFParagraph with an corresponding CTPparagraph in the paragraphList of this header or footer XWPFParagraph with the correspondig CTP p

### getParagraphArray

    public XWPFParagraph getParagraphArray(int pos)

  Returns the paragraph that holds the text of the header or footer.

  Specified by:
    `getParagraphArray` in interface `IBody`

### getListParagraph

    public java.util.List<XWPFParagraph> getListParagraph()

  get a List of all Paragraphs

  Returns:
    a list of `XWPFParagraph`

### getAllPictures

    public java.util.List<XWPFPictureData> getAllPictures()

### getAllPackagePictures

    public java.util.List<XWPFPictureData> getAllPackagePictures()

  get all Pictures in this package

  Returns:
    all Pictures in this package

### addPicture

    public int addPicture(java.io.InputStream is,
                          int format)
                   throws java.io.IOException

  Adds a picture to the document.

  Parameters:
    `is` - The stream to read image from
    `format` - The format of the picture.
  Returns:
    the index to this picture (0 based), the added picture can be obtained from `getAllPictures()` .
  Throws:
    `java.io.IOException`

### addPicture

    public int addPicture(byte[] pictureData,
                          int format)

  Adds a picture to the document.

  Parameters:
    `pictureData` - The picture bytes
    `format` - The format of the picture.
  Returns:
    the index to this picture (0 based), the added picture can be obtained from `getAllPictures()` .

### getNextPicNameNumber

    public int getNextPicNameNumber(int format)

  get the next free ImageNumber

  Parameters:
    `format` -
  Returns:
    the next free ImageNumber

### getPictureDataByID

    public XWPFPictureData getPictureDataByID(java.lang.String blipID)

  returns the PictureData by blipID

  Parameters:
    `blipID` -
  Returns:
    XWPFPictureData of a specificID
  Throws:
    `java.lang.Exception`

### addPictureReference

    public PackageRelationship addPictureReference(byte[] pictureData,
                                                   int format)

  Add the picture to drawing relations

  Parameters:
    `pictureData` - the picture bytes
    `format` - the picture format

### addPictureReference

    public PackageRelationship addPictureReference(java.io.InputStream is,
                                                   int format)

  Add the picture to drawing relations

  Parameters:
    `is` - the stream to read picture data from

### insertNewParagraph

    public XWPFParagraph insertNewParagraph(org.apache.xmlbeans.XmlCursor cursor)

  add a new paragraph at position of the cursor

  Specified by:
    `insertNewParagraph` in interface `IBody`
  Parameters:
    `cursor` -
  Returns:
    the inserted paragraph

### insertNewTbl

    public XWPFTable insertNewTbl(org.apache.xmlbeans.XmlCursor cursor)

  Description copied from interface: `IBody`
  inserts a new Table at the cursor position.

  Specified by:
    `insertNewTbl` in interface `IBody`
  Parameters:
    `cursor` -
  Returns:
    the inserted table

### getOwner

    public POIXMLDocumentPart getOwner()

### getTableArray

    public XWPFTable getTableArray(int pos)

  Returns the table at position pos

  Specified by:
    `getTableArray` in interface `IBody`
  See Also:
    `IBody.getTableArray(int)`

### insertTable

    public void insertTable(int pos,
                            XWPFTable table)

  inserts an existing XWPFTable to the arrays bodyElements and tables

  Specified by:
    `insertTable` in interface `IBody`
  Parameters:
    `pos` -
    `table` -

### readHdrFtr

    public void readHdrFtr()

### getTableCell

    public XWPFTableCell getTableCell(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc cell)

  get the TableCell which belongs to the TableCell

  Specified by:
    `getTableCell` in interface `IBody`
  Parameters:
    `cell` -

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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