List of usage examples for org.apache.poi.xwpf.usermodel XWPFDocument getBodyElements
@Override
public List<IBodyElement> getBodyElements()
From source file:org.obeonetwork.m2doc.generator.DocumentGenerator.java
License:Open Source License
/** * creates the destination document.//from ww w. j a v a 2s. c om * * @param inputDocumentFileName * the name of the destination document's file. * @return the created document * @throws IOException * if an I/O problem occurs. * @throws InvalidFormatException * if the generated file has a format problem. */ private XWPFDocument createDestinationDocument(String inputDocumentFileName) throws IOException, InvalidFormatException { FileInputStream is = new FileInputStream(inputDocumentFileName); OPCPackage oPackage = OPCPackage.open(is); XWPFDocument document = new XWPFDocument(oPackage); int size = document.getBodyElements().size(); for (int i = 0; i < size; i++) { document.removeBodyElement(0); } return document; }
From source file:org.obeonetwork.m2doc.generator.test.TemplateProcessorTest.java
License:Open Source License
private XWPFDocument createDestinationDocument(String inputDocumentFileName) throws IOException, InvalidFormatException { FileInputStream is = new FileInputStream(inputDocumentFileName); OPCPackage oPackage = OPCPackage.open(is); XWPFDocument document = new XWPFDocument(oPackage); int size = document.getBodyElements().size(); for (int i = 0; i < size; i++) { document.removeBodyElement(0);// w w w . j a v a2 s . c om } return document; }