Generate XLS report Multiple Sheet Apache XSSF

Generate XLS report Multiple Sheet Apache XSSF

In previous tutorials you have many ways to generate report in XLS format. In this example you will see how to generate XLS report using Apache POI-XSSF. You could directly copy this project and include any of your XLS report generation requirement.

Tools needed:

  • Any latest version of Eclipse
  • JDK 1.8
  • Apache XSSF related jars (Dependencies already included in project)
  • Maven (It comes with eclipse)

Maven project name: ApacheXSSFReportJava:

Generate XLS report Multiple Sheet Apache XSSF

  • Project dependencies:pom.xml:

  • Spring context file: common-context.xml

  • Model to load dummry data into xls sheet:

  • Report filed class which represents XLS column names: JavaHonkReportFields.java

  • Main XLS generator class: JavaHonkExcelReportGenerator.java

  • Report generator class which extends JavaHonkExcelReportGenerator to put logic to pull to data and generate XLS sheet:

  • JavaHonkMainApp.java class which load Spring context and use class to generate the report:

  • Now to generate the report right click JavaHonkMainApp –> Run As –> Java application in eclipse you will see report generated in current project directory (Please refresh your project)

Generate XLS report Multiple Sheet Apache XSSF

  • Generated report:

Generate XLS report Multiple Sheet Apache XSSF

Leave a Reply

Your email address will not be published. Required fields are marked *