public String getText() { StringBuilder text = new StringBuilder(64); XWPFHeaderFooterPolicy hfPolicy = document.getHeaderFooterPolicy(); // Start out with all headers extractHeaders(text, hfPolicy); // Process all body elements for (IBodyElement e : document.getBodyElements()) { appendBodyElementText(text, e); text.append('\n'); } // Finish up with all the footers extractFooters(text, hfPolicy); return text.toString(); }
public String getText() { StringBuilder text = new StringBuilder(64); XWPFHeaderFooterPolicy hfPolicy = document.getHeaderFooterPolicy(); // Start out with all headers extractHeaders(text, hfPolicy); // Process all body elements for (IBodyElement e : document.getBodyElements()) { appendBodyElementText(text, e); text.append('\n'); } // Finish up with all the footers extractFooters(text, hfPolicy); return text.toString(); }
private void passaElementi(XWPFDocument doc1){ for(IBodyElement e : doc1.getBodyElements()){ if(e instanceof XWPFParagraph){ XWPFParagraph p = (XWPFParagraph) e; if(p.getCTP().getPPr()!=null && p.getCTP().getPPr().getSectPr()!=null){ continue; }else{ document.createParagraph(); document.setParagraph(p, i); i++; } }else if(e instanceof XWPFTable){ XWPFTable t = (XWPFTable)e; document.createTable(); document.setTable(j, t); j++; }else if(e instanceof XWPFSDT){ // boh! } } }
/** * Create a pdf version of the document, using XSL FO. * * @param wmlStyles * @param wmlDocument * @param os The OutputStream to write the pdf to */ public void output( OutputStream os ) throws Exception { try { // body.get List<IBodyElement> bodyElement = document.getBodyElements(); for ( IBodyElement iBodyElement : bodyElement ) { visit( iBodyElement ); } } catch ( Exception e ) { e.printStackTrace(); throw new Exception( "iTextissues", e ); } finally { // Flush writer.save( os ); } }
/** * Main entry for visit XWPFDocument. * * @param out * @throws Exception */ public void start() throws Exception { // start document T container = startVisitDocument(); // Create IText, XHTML element for each XWPF elements from the w:body List<IBodyElement> bodyElements = document.getBodyElements(); visitBodyElements( bodyElements, container ); // end document endVisitDocument(); }
/** * Main entry for visit XWPFDocument. * * @param out * @throws Exception */ public void start() throws Exception { // start document T container = startVisitDocument(); // Create IText, XHTML element for each XWPF elements from the w:body List<IBodyElement> bodyElements = document.getBodyElements(); visitBodyElements( bodyElements, container ); // end document endVisitDocument(); }
/** * Main entry for visit XWPFDocument. * * @param out * @throws Exception */ public void start() throws Exception { // start document T container = startVisitDocument(); // Create IText, XHTML element for each XWPF elements from the w:body List<IBodyElement> bodyElements = document.getBodyElements(); visitBodyElements( bodyElements, container ); // end document endVisitDocument(); }
private Stack<CTSectPr> getSectPrStack() { if ( sectPrStack != null ) { return sectPrStack; } sectPrStack = new Stack<CTSectPr>(); for ( IBodyElement bodyElement : document.getBodyElements() ) { if ( bodyElement.getElementType() == BodyElementType.PARAGRAPH ) { CTPPr ppr = ( (XWPFParagraph) bodyElement ).getCTP().getPPr(); if ( ppr != null ) { CTSectPr sectPr = ppr.getSectPr(); if ( sectPr != null ) { sectPrStack.push( sectPr ); } } } } return sectPrStack; }
XWPFParagraph imageParagraph = null; List<IBodyElement> documentElements = document.getBodyElements(); for(IBodyElement documentElement : documentElements){ imageParagraphPos ++; document.removeBodyElement(document.getBodyElements().size() - 1);
sdts.addAll(extractSDTsFromBodyElements(header.getBodyElements())); sdts.addAll(extractSDTsFromBodyElements(doc.getBodyElements()));
/** * Main entry for visit XWPFDocument. * * @param out * @throws Exception */ public void visit( OutputStream out ) throws Exception { T container = startVisitDocument( out ); // Create Header/Footer CTSectPr sectPr = document.getDocument().getBody().getSectPr(); visitHeadersFooters( sectPr, container ); // Create IText element for each XWPF elements from the w:body List<IBodyElement> bodyElements = document.getBodyElements(); visitBodyElements( bodyElements, container ); // Save // Clean-up endVisitDocument(); out.close(); }
for (IBodyElement bodyElement : doc.getBodyElements()) {