List of usage examples for org.apache.poi.openxml4j.opc OPCPackage open
public static OPCPackage open(InputStream in) throws InvalidFormatException, IOException
From source file:org.obeonetwork.m2doc.generator.test.DocumentGeneratorTest.java
License:Open Source License
@Test public void testVarRefStyledProcessing() throws InvalidFormatException, IOException, DocumentParserException, DocumentGenerationException { IQueryEnvironment queryEnvironment = org.eclipse.acceleo.query.runtime.Query .newEnvironmentWithDefaultServices(null); FileInputStream is = new FileInputStream("templates/testVarStyle.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/testVarStyle.docx", "results/testVarStyleResult.docx", template, definitions, queryEnvironment); generator.generate();//from w w w . java 2 s. c om }
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 w w w .ja v a 2 s . c o 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 .j a va2s. co 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();/* w ww.j a va2 s . c om*/ }
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 ww.j ava 2s .co 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();/*ww w .j a v a2 s .c om*/ }
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 .ja va 2 s . c om }
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();//w w w .j av a 2 s . c om }
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();/* ww w .ja v a 2s . 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();//from w w w . ja va2s.c om }