Example usage for org.apache.poi.xwpf.usermodel XWPFFooter XWPFFooter

List of usage examples for org.apache.poi.xwpf.usermodel XWPFFooter XWPFFooter

Introduction

In this page you can find the example usage for org.apache.poi.xwpf.usermodel XWPFFooter XWPFFooter.

Prototype

public XWPFFooter(POIXMLDocumentPart parent, PackagePart part) throws IOException 

Source Link

Usage

From source file:fr.opensagres.poi.xwpf.converter.core.XWPFDocumentVisitor.java

License:Open Source License

/**
 * Returns the {@link XWPFFooter} of the given footer reference.
 * /*from w w w.jav a 2s .c om*/
 * @param footerRef the footer reference.
 * @return
 * @throws XmlException
 * @throws IOException
 */
protected XWPFFooter getXWPFFooter(CTHdrFtrRef footerRef) throws XmlException, IOException {
    PackagePart hdrPart = document.getPartById(footerRef.getId());
    List<XWPFFooter> footers = document.getFooterList();
    for (XWPFFooter footer : footers) {
        if (footer.getPackagePart().equals(hdrPart)) {
            // footer is aleady loaded, return it.
            return footer;
        }
    }
    // should never come, but load the footer if needed.
    FtrDocument hdrDoc = FtrDocument.Factory.parse(hdrPart.getInputStream());
    CTHdrFtr hdrFtr = hdrDoc.getFtr();
    XWPFFooter ftr = new XWPFFooter(document, hdrFtr);
    return ftr;
}