Using jxls for working with Excel files in java

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.

Here are some examples of what you can do with jxls:

  1.  How to create jxls template.
  2.  Beginner example of output data to excel file by template.

 

 

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.