Welcome to Jxls-2!

News

Jxls-2 is a full rewrite from scratch of the original Jxls 1.x library to make it much more flexible and improve the performance.

Jxls-2 completely de-couples itself from the underlying Java-to-Excel transformation engine so that it is possible to switch low-level Java-to-Excel library without any code changes.

Excel template markup can now be redefined in a way you like.

Jxls-2 introduces a concept of Command to replace previously used tags (like jx:forEach, jx:if). Command is not tied to any particular Excel mark-up. In fact it can be defined completely in Java or by using built-in Excel-comment or XML-based mark-ups.

Custom post- and pre- processing code can now also be easily injected into Excel transformation.

Please note that Jxls-2 is not backwards compatible with Jxls 1.x.

If you wish to upgrade your existing Jxls 1.x reports for Jxls-2 you will have to rewrite the code and change the notation in XLS template.

Introduction

Jxls is a small Java library to make generation of Excel reports easy. Jxls uses a special markup in Excel templates to define output formatting and data layout.

Excel generation is required in many Java applications that have some kind of reporting functionality.

Java has great open-source and commercial libraries for creating Excel files (of open source ones worth mentioning are Apache POI and Java Excel API.

Those libraries are quite low-level in a sense that they require you to write a lot of Java code even to create simple Excel files.

Usually you have to manually set each cell formatting and data for the spreadsheet. Depending on the complexity of the report layout and data formatting the Java code can become quite complex and difficult to debug and maintain. In addition not all Excel features are supported and can be manipulated with API(for example macros or graphs). The suggested workaround for unsupported features is to create the object manually in an Excel template and fill the template with data after that.

Jxls takes this approach to a higher level. All you need to do when working with Jxls is just to define all your report formatting and data layout in an Excel template and run Jxls engine providing it with the data to fill in the template. The only code you need to write in the most cases is a simple invocation of Jxls engine with proper configuration.

Features

  • XML and binary Excel format output (depends on underlying low-level Java-to-Excel implementation)
  • Java collections output by rows and by columns
  • Conditional output
  • Expression language in report definition markup (Apache JEXL syntax is supported)
  • Multi-spreadsheet generation
  • Native Excel formulas
  • Parameterized formulas
  • Merged cells support
  • Area listeners to adjust excel generation
  • Excel comments mark-up for command definition
  • XML mark-up for command definition
  • Custom Command definition