List of usage examples for org.apache.poi.xwpf.usermodel XWPFDocument getFooterList
public List<XWPFFooter> getFooterList()
From source file:biz.webgate.dominoext.poi.component.kernel.DocumentProcessor.java
License:Apache License
public int processBookmarks2Document(XWPFDocument dxProcess, List<IDocumentBookmark> arrBookmarks) { // First Prozessing all paragraphs. for (XWPFParagraph paraCurrent : dxProcess.getParagraphs()) { processBookmarks2Paragraph(arrBookmarks, paraCurrent); }/* w w w.ja v a 2 s.c o m*/ for (XWPFTable tabCurrent : dxProcess.getTables()) { processBookmarks2Table(arrBookmarks, tabCurrent); } for (XWPFHeader headCurrent : dxProcess.getHeaderList()) { for (XWPFParagraph paraCurrent : headCurrent.getParagraphs()) { processBookmarks2Paragraph(arrBookmarks, paraCurrent); } for (XWPFTable tabCurrent : headCurrent.getTables()) { processBookmarks2Table(arrBookmarks, tabCurrent); } } for (XWPFFooter footCurrent : dxProcess.getFooterList()) { for (XWPFParagraph paraCurrent : footCurrent.getParagraphs()) { processBookmarks2Paragraph(arrBookmarks, paraCurrent); } for (XWPFTable tabCurrent : footCurrent.getTables()) { processBookmarks2Table(arrBookmarks, tabCurrent); } } return 1; }
From source file:com.bxf.hradmin.testgen.service.impl.DocxTestGenerator.java
License:Open Source License
private void replaceWordHolder(XWPFDocument doc) { doc.getParagraphs().forEach(paragraph -> { Map<String, String> data = new HashMap<>(); data.put("score", "4"); doReplace(paragraph, data);/*from w ww. ja v a 2 s . c o m*/ }); doc.getFooterList().forEach(footer -> footer.getParagraphs().forEach(paragraph -> { Map<String, String> data = new HashMap<>(); data.put("year", new SimpleDateFormat("yyyy").format(new Date())); doReplace(paragraph, data); })); }
From source file:offishell.word.Word.java
License:MIT License
/** * <p>/*from w w w . j a v a2s . c o m*/ * Replace variable text. * </p> * * @param doc * @param object */ private void replace(XWPFDocument doc) { // for paragraph for (XWPFParagraph para : copy(doc.getParagraphs())) { replace(para); } // for table for (XWPFTable table : copy(doc.getTables())) { for (XWPFTableRow row : copy(table.getRows())) { for (XWPFTableCell cell : copy(row.getTableCells())) { for (XWPFParagraph para : copy(cell.getParagraphs())) { replace(para); } } } } // for header for (XWPFHeader header : copy(doc.getHeaderList())) { for (XWPFParagraph para : copy(header.getParagraphs())) { replace(para); } } // for footer for (XWPFFooter footer : copy(doc.getFooterList())) { for (XWPFParagraph para : copy(footer.getParagraphs())) { replace(para); } } }
From source file:org.obeonetwork.m2doc.generator.M2DocEvaluator.java
License:Open Source License
@Override public IConstruct caseDocumentTemplate(DocumentTemplate documentTemplate) { doSwitch(documentTemplate.getBody()); final XWPFDocument document = (XWPFDocument) generatedDocument; final Iterator<XWPFFooter> footers = document.getFooterList().iterator(); for (final Template footer : documentTemplate.getFooters()) { final XWPFFooter f = footers.next(); cleanHeaderFooter(f);/* w w w . j a v a2 s .c o m*/ generatedDocument = f; doSwitch(footer); } final Iterator<XWPFHeader> headers = document.getHeaderList().iterator(); for (final Template header : documentTemplate.getHeaders()) { final XWPFHeader h = headers.next(); cleanHeaderFooter(h); generatedDocument = h; doSwitch(header); } return null; }