Scroll Top

Jasper Reports Generation in XLS Format

Getting your Trinity Audio player ready...

Problem Statement:

Inbuilt reporting engine inside an ERP application is good value addition for user and If ERP can allow integration of third party reporting engine as well then it is further value add. ADempiere supports reporting in two ways

  • In built reporting engine( Print formats)
  • Jasper report integration

Print formats allow reporting to be done in different formats like PDF,XLS and HTML. In case of Jasper Reports integration, reporting can be done only in PDF format. But there is growing need to support other formats like XLS and HTML for Jasper based reports as well in ADempiere. Another important need is user should have a choice to decide report output format( The way it works in Print Format )

Scope of Article:

As a part of this article we will cover the changes we need to do to generate different formats based on user choice (i.e. PDF or XLS).

 Technology :

  • ADempiere 360 or above
  • Need poi-3.7.jar

Current Behavior :

  1. Run Expense Management report which is developed in Jasper and integrated into ADempiere

  2. Clicked on Start button, then report is generated in PDF format by default.
  3. There is no option to select specific format of report in tool bar 

Changes Detail :

We need to make code changes in ZkJRViewer.java file to generate report in XLS format.

      1. Add poi-3.7.jar in classpath
      2. Import following files into ZkJRViewer.java file.
      3. Implement EventListener interface into ZkJRViewer.java file.

      1. Add following Instance variables

      1. Update ZkJRViewer() constructor to invoke super class constructor.

      1. add  following changes in init() method to have drop down in toolbar to select PDF or XLS

      1. update onEvent() method to invoke renderReport() method to generate report in selected format

      1. Following renderReport() method can generate report in PDF or XLS based on previewType selection.

      1. After applying above changes, start application and run the same report and check the drop down to select report format PDF or XLS

      1. Now select Excel to generate report in XLS format.

 

      1. Following is the generated XLS format report.

Summary:

As a part of this article we come to know what are the changes need to do to have XLS report format in ADempiere. After applying changes User can select either PDF or XLS format of report. Hope you have enjoyed reading this article.

Walking Tree promotes ADempiere and we support the users as well as the developers to ensure that the business is able to take complete advantage of ADempiere’s wonderful capability. In case you are looking for a professional assistance then do visit our website to get in touch with us.

References :

  • http://mvnrepository.com/artifact/org.apache.poi/poi/3.7
  • http://community.jaspersoft.com/questions/518462/problems-exporting-excel
  • http://p2p.wrox.com/j2ee/38785-exporting-data-into-excel-using-jasper-reports.html

Leave a comment

Privacy Preferences
When you visit our website, it may store information through your browser from specific services, usually in form of cookies. Here you can change your privacy preferences. Please note that blocking some types of cookies may impact your experience on our website and the services we offer.