opensagres / xdocreport

XDocReport means XML Document reporting. It's Java API to merge XML document created with MS Office (docx) or OpenOffice (odt), LibreOffice (odt) with a Java model to generate report and convert it if you need to another format (PDF, XHTML...).
https://github.com/opensagres/xdocreport
1.19k stars 369 forks source link

Null template engine. Set template engine with IXDocReport#setTemplateEngine. #181

Open saru17 opened 7 years ago

saru17 commented 7 years ago

Hi,

I am using xdoxreport.jar(version 5). My code :

  // 1) Load file by filling Velocity template engine and cache it to the registry
      InputStream in = Application.class.getResourceAsStream("DocxProjectWithVelocity.docx");
        //InputStream in = new FileInputStream(new File("C:/DocxProjectWithVelocity.docx"));
      IXDocReport report = XDocReportRegistry.getRegistry().loadReport(in, TemplateEngineKind.Velocity);

      // 2) Create context Java model
      IContext context = report.createContext();
      Test project = new Test("TESTING XDOCREPORT");

I am facing issue : Caused by: java.lang.ClassNotFoundException: freemarker.template.ObjectWrapper at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 12 more fr.opensagres.xdocreport.core.XDocReportException: Null template engine. Set template engine with IXDocReport#setTemplateEngine. at fr.opensagres.xdocreport.document.AbstractXDocReport.internalGetTemplateEngine(AbstractXDocReport.java:866) at fr.opensagres.xdocreport.document.AbstractXDocReport.createContext(AbstractXDocReport.java:462) at testXdocreport.Application.main(Application.java:26)

angelozerr commented 7 years ago

Have you freemarker in your classpath?