Jxls v2.3.0 is released!

What’s New

Now you can use a markup in Excel template to output a collection into multiple sheets. See Multiple sheets output section and Multi sheet markup example

Also the following issues have been fixed

There are also the following api changes

  • Method createInitialContext() was removed from Transformer interface

    The static method of the same name in PoiTransformer and JexcelTransformer can now be used for the same purpose (e.g. PoiTransformer.createInitialContext())

  • transform method in Transformer interface is now taking an additional parameter boolean updateRowHeight indicating if a row height needs to be updated

  • A new method void updateRowHeight(String srcSheetName, int srcRowNum, String targetSheetName, int targetRowNum) is added to Transformer interface to copy row height from a source row to a target row.

See description of previous releases at Version History

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
  • Multiple sheets output
  • 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

Component versions

  • org.jxls:jxls:2.3.0

  • org.jxls:jxls-poi:1.0.9

  • org.jxls:jxls-jexcel:1.0.6

  • org.jxls:jxls-reader:2.0.2