List of usage examples for org.apache.poi.xwpf.usermodel XWPFDocument XWPFDocument
public XWPFDocument(InputStream is) throws IOException
From source file:org.obeonetwork.m2doc.generator.test.DocumentGeneratorTest.java
License:Open Source License
@Test public void testVarRefStyledMultipleParagraphsProcessing() throws InvalidFormatException, IOException, DocumentParserException, DocumentGenerationException { IQueryEnvironment queryEnvironment = org.eclipse.acceleo.query.runtime.Query .newEnvironmentWithDefaultServices(null); FileInputStream is = new FileInputStream("templates/testVarStyleSpanning2Paragraphs.docx"); OPCPackage oPackage = OPCPackage.open(is); XWPFDocument document = new XWPFDocument(oPackage); DocumentParser parser = new DocumentParser(document, queryEnvironment); DocumentTemplate template = parser.parseDocument(); Map<String, Object> definitions = new HashMap<String, Object>(); definitions.put("x", "valueofx"); DocumentGenerator generator = new DocumentGenerator("templates/testVarStyleSpanning2Paragraphs.docx", "results/testVarStyleSpanning2ParagraphsResult.docx", template, definitions, queryEnvironment); generator.generate();//from www .j a va 2s. co m }
From source file:org.obeonetwork.m2doc.generator.test.DocumentGeneratorTest.java
License:Open Source License
@Test public void testQueryStyledProcessing() throws InvalidFormatException, IOException, DocumentParserException, DocumentGenerationException { IQueryEnvironment queryEnvironment = org.eclipse.acceleo.query.runtime.Query .newEnvironmentWithDefaultServices(null); FileInputStream is = new FileInputStream("templates/testAQL.docx"); OPCPackage oPackage = OPCPackage.open(is); XWPFDocument document = new XWPFDocument(oPackage); DocumentParser parser = new DocumentParser(document, queryEnvironment); DocumentTemplate template = parser.parseDocument(); Map<String, Object> definitions = new HashMap<String, Object>(); definitions.put("self", EcorePackage.eINSTANCE); DocumentGenerator generator = new DocumentGenerator("templates/testAQL.docx", "results/testAQLResult.docx", template, definitions, queryEnvironment); generator.generate();/*from w ww. jav a 2 s . c o m*/ }
From source file:org.obeonetwork.m2doc.generator.test.DocumentGeneratorTest.java
License:Open Source License
@Test public void testQueryStyledErrorProcessing() throws InvalidFormatException, IOException, DocumentParserException, DocumentGenerationException { IQueryEnvironment queryEnvironment = org.eclipse.acceleo.query.runtime.Query .newEnvironmentWithDefaultServices(null); FileInputStream is = new FileInputStream("templates/testAQL.docx"); OPCPackage oPackage = OPCPackage.open(is); XWPFDocument document = new XWPFDocument(oPackage); DocumentParser parser = new DocumentParser(document, queryEnvironment); DocumentTemplate template = parser.parseDocument(); Map<String, Object> definitions = new HashMap<String, Object>(); DocumentGenerator generator = new DocumentGenerator("templates/testAQL.docx", "results/testAQLResult.docx", template, definitions, queryEnvironment); generator.generate();// www . java2 s . co m }
From source file:org.obeonetwork.m2doc.generator.test.DocumentGeneratorTest.java
License:Open Source License
@Test public void testGDFORProcessing() throws InvalidFormatException, IOException, DocumentParserException, DocumentGenerationException { IQueryEnvironment queryEnvironment = org.eclipse.acceleo.query.runtime.Query .newEnvironmentWithDefaultServices(null); FileInputStream is = new FileInputStream("templates/testGDFOR.docx"); OPCPackage oPackage = OPCPackage.open(is); XWPFDocument document = new XWPFDocument(oPackage); DocumentParser parser = new DocumentParser(document, queryEnvironment); DocumentTemplate template = parser.parseDocument(); Map<String, Object> definitions = new HashMap<String, Object>(); definitions.put("self", EcorePackage.eINSTANCE); DocumentGenerator generator = new DocumentGenerator("templates/testGDFOR.docx", "results/testGDFOR.docx", template, definitions, queryEnvironment); generator.generate();//from w w w . j a v a2s . c o m }
From source file:org.obeonetwork.m2doc.generator.test.DocumentGeneratorTest.java
License:Open Source License
@Test public void testGDFORWithTableProcessing() throws InvalidFormatException, IOException, DocumentParserException, DocumentGenerationException { IQueryEnvironment queryEnvironment = org.eclipse.acceleo.query.runtime.Query .newEnvironmentWithDefaultServices(null); FileInputStream is = new FileInputStream("templates/testGDFORWithTable.docx"); OPCPackage oPackage = OPCPackage.open(is); XWPFDocument document = new XWPFDocument(oPackage); DocumentParser parser = new DocumentParser(document, queryEnvironment); DocumentTemplate template = parser.parseDocument(); Map<String, Object> definitions = new HashMap<String, Object>(); definitions.put("self", EcorePackage.eINSTANCE); DocumentGenerator generator = new DocumentGenerator("templates/testGDFORWithTable.docx", "results/testGDFORWithTable.docx", template, definitions, queryEnvironment); generator.generate();/*from w ww. j ava 2 s.c o m*/ }
From source file:org.obeonetwork.m2doc.generator.test.DocumentGeneratorTest.java
License:Open Source License
@Test public void testConditionnal1trueProcessing() throws InvalidFormatException, IOException, DocumentParserException, DocumentGenerationException { IQueryEnvironment queryEnvironment = org.eclipse.acceleo.query.runtime.Query .newEnvironmentWithDefaultServices(null); FileInputStream is = new FileInputStream("templates/testConditionnal1.docx"); OPCPackage oPackage = OPCPackage.open(is); XWPFDocument document = new XWPFDocument(oPackage); DocumentParser parser = new DocumentParser(document, queryEnvironment); DocumentTemplate template = parser.parseDocument(); Map<String, Object> definitions = new HashMap<String, Object>(); definitions.put("x", "value1"); DocumentGenerator generator = new DocumentGenerator("templates/testConditionnal1.docx", "results/testConditionnal1Result.docx", template, definitions, queryEnvironment); generator.generate();//from w ww.jav a 2s. co m }
From source file:org.obeonetwork.m2doc.generator.test.DocumentGeneratorTest.java
License:Open Source License
@Test public void testConditionnal1falseProcessing() throws InvalidFormatException, IOException, DocumentParserException, DocumentGenerationException { IQueryEnvironment queryEnvironment = org.eclipse.acceleo.query.runtime.Query .newEnvironmentWithDefaultServices(null); FileInputStream is = new FileInputStream("templates/testConditionnal1.docx"); OPCPackage oPackage = OPCPackage.open(is); XWPFDocument document = new XWPFDocument(oPackage); DocumentParser parser = new DocumentParser(document, queryEnvironment); DocumentTemplate template = parser.parseDocument(); Map<String, Object> definitions = new HashMap<String, Object>(); definitions.put("x", "valueofx"); DocumentGenerator generator = new DocumentGenerator("templates/testConditionnal1.docx", "results/testConditionnal1FalseResult.docx", template, definitions, queryEnvironment); generator.generate();/*from w w w.j av a 2s . c o m*/ }
From source file:org.obeonetwork.m2doc.generator.test.DocumentGeneratorTest.java
License:Open Source License
@Test public void testConditionnal2Processing() throws InvalidFormatException, IOException, DocumentParserException, DocumentGenerationException { IQueryEnvironment queryEnvironment = org.eclipse.acceleo.query.runtime.Query .newEnvironmentWithDefaultServices(null); FileInputStream is = new FileInputStream("templates/testConditionnal2.docx"); OPCPackage oPackage = OPCPackage.open(is); XWPFDocument document = new XWPFDocument(oPackage); DocumentParser parser = new DocumentParser(document, queryEnvironment); DocumentTemplate template = parser.parseDocument(); Map<String, Object> definitions = new HashMap<String, Object>(); definitions.put("x", "value1"); DocumentGenerator generator = new DocumentGenerator("templates/testConditionnal2.docx", "results/testConditionnal2Result.docx", template, definitions, queryEnvironment); generator.generate();//from w w w. ja v a2 s. c om }
From source file:org.obeonetwork.m2doc.generator.test.DocumentGeneratorTest.java
License:Open Source License
@Test public void testConditionnalFalseProcessing() throws InvalidFormatException, IOException, DocumentParserException, DocumentGenerationException { IQueryEnvironment queryEnvironment = org.eclipse.acceleo.query.runtime.Query .newEnvironmentWithDefaultServices(null); FileInputStream is = new FileInputStream("templates/testConditionnal2.docx"); OPCPackage oPackage = OPCPackage.open(is); XWPFDocument document = new XWPFDocument(oPackage); DocumentParser parser = new DocumentParser(document, queryEnvironment); DocumentTemplate template = parser.parseDocument(); Map<String, Object> definitions = new HashMap<String, Object>(); definitions.put("x", "valueofx"); DocumentGenerator generator = new DocumentGenerator("templates/testConditionnal2.docx", "results/testConditionnal2FalseResult.docx", template, definitions, queryEnvironment); generator.generate();//w ww .jav a 2 s . c o m }
From source file:org.obeonetwork.m2doc.generator.test.DocumentGeneratorTest.java
License:Open Source License
@Test public void testImagesAndFootersAndHeadersAndBullets() throws InvalidFormatException, IOException, DocumentParserException, DocumentGenerationException { IQueryEnvironment queryEnvironment = org.eclipse.acceleo.query.runtime.Query .newEnvironmentWithDefaultServices(null); queryEnvironment.registerEPackage(EcorePackage.eINSTANCE); FileInputStream is = new FileInputStream("templates/test.docx"); OPCPackage oPackage = OPCPackage.open(is); XWPFDocument document = new XWPFDocument(oPackage); DocumentParser parser = new DocumentParser(document, queryEnvironment); DocumentTemplate template = parser.parseDocument(); Map<String, Object> definitions = new HashMap<String, Object>(); definitions.put("self", EcorePackage.eINSTANCE); DocumentGenerator generator = new DocumentGenerator("templates/test.docx", "results/testResult.docx", template, definitions, queryEnvironment); generator.generate();//from w w w.java2 s. c o m }