AnsweredAssumed Answered

Javascript service: generating Jasper report with XML data

Question asked by msvoren on May 12, 2011
Latest reply on Mar 9, 2017 by kawther
Hi everyone,
We were playing with Alfresco and JasperReport the other day. 
There's always a problem when you want to generate any kind of report from Alfresco repository information/data.
We came up with an idea to generate reports inside Alfresco and provide XML as a data-source. It's XML because it's easy to generate it with FTL inside Alfresco.

Having that on mind, we created a Server-side javascript service that will take XML data-source and Jasper's JRXML file and generate report in [pdf, xls, docx] type. Service will then save that report as document on alfresco repository.

All files you need for this plus installation notes you can find on:
http://code.google.com/p/alfresco-generate-reports-with-jasperreports/

Service syntax:

jasperReportsHelper.generateXMLDataSourceReport(    
                  xmlDataSourceString,
                  xpath report query,
                  nodeRef object of japer report document located on repository,
                  nodeRef object of destination folder to place generated report,
                  output format ["pdf", "xls", "docx"]
         );

Credits for java development go to Jan Čustović.

Outcomes