@Override public List<ElementTemplate> visitDocument(XWPFDocument doc) { if (null == doc) return null; this.eleTemplates = new ArrayList<ElementTemplate>(); visitParagraphs(doc.getParagraphs()); visitTables(doc.getTables()); visitHeaders(doc.getHeaderList()); visitFooters(doc.getFooterList()); return eleTemplates; }
List<XWPFFooter> footers = doc.getFooterList(); for (XWPFFooter footer : footers) { sdts.addAll(extractSDTsFromBodyElements(footer.getBodyElements()));
/** * Returns the {@link XWPFFooter} of the given footer reference. * * @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; }
/** * Returns the {@link XWPFFooter} of the given footer reference. * * @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; }
/** * Returns the {@link XWPFFooter} of the given footer reference. * * @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; }