XDocReportService { @Programmatic public byte[] render( final byte[] templateBytes, final XDocReportModel dataModel, final OutputType outputType) throws IOException { try { final byte[] docxBytes = toDocx(templateBytes, dataModel); switch (outputType) { case PDF: return toPdf(docxBytes); default: return docxBytes; } } catch (XDocReportException e) { throw new IOException(e); } }  @PostConstruct void init(); @Programmatic byte[] render(
            final byte[] templateBytes,
            final XDocReportModel dataModel,
            final OutputType outputType);  }
@Test public void simple() throws Exception { InputStream in= new FileInputStream(new File("src/test/java/org/apache/isis/subdomains/xdocreport/applib/service/example/template/Project-template.docx")); final byte[] templateBytes = IOUtils.toByteArray(in); Project project = new Project("XDocReport"); List<Developer> developers = new ArrayList<>(); developers.add(new Developer("ZERR", "Angelo", "angelo.zerr@gmail.com")); developers.add(new Developer("Leclercq", "Pascal", "pascal.leclercq@gmail.com")); final ProjectDevelopersModel dataModel = new ProjectDevelopersModel(project, developers); final byte[] docxBytes = service.render(templateBytes, dataModel, OutputType.DOCX); new File("target").mkdir(); IOUtils.write(docxBytes,new FileOutputStream(new File("target/Project.docx"))); }