jbaliuka / x4j-analytic

Excel reporting library for JAVA
44 stars 18 forks source link

x4j-analytic Build Status Coverage Status

x4j-analytic is an open source XLSX format template engine API for Java programming language. X4J is used as the embedded library in Java applications to implement full blown reporting solutions.

License

This projected is licensed under the terms of the Apache v2 license

Performance

X4J Engine is designed to produce relatively large reports and to consume reasonable amount of memory on reporting servers, WEB applications, batch reports. This implementation uses sequential processing and normally X4J should be able to produce report with a million rows in a couple of seconds using constant memory. Pivot Report feature helps to manage large amounts of data.

Excel Support

X4J primary input/output format is XLSX, Excel is used as design to edit templates. Engine has limited capabilities to export report to other formats too: pdf, csv ,html, xml. Engine is usually used to implement Pivot reports with Excel table as source data. X4J binds SQL query data to Excel tables and columns by name without special template language or tags. Excel XML Map is also supported to import/export Table data as XML.

Template Language

Advanced reports might use optional template language and scripting. It might be useful for simple dynamic headers or localized strings but we suggest not to abuse programming concepts for reports, language is very simple but it is better extend engine itself to add features or to solve specific problems.

Samples

View code examples online or clone git repository. View sample reports on repository.

Normally we use two files for every report, query and parameter declarations are stored as XML Template is a regular Excel file in XLSX format with Table and Pivot Table and engine populates Table with query results. Excel Table name should match query name in XML file. Context variables might referenced as ${myContextVariable}. Templates also support Velocity like language with loops and flow control statements: #if,#for, ..., #end

Building X4J from Source Code

Maven is used to build X4J

Similar Projects

There are other similar Excel template engines and they should work for small Excel reports too.

X4J is designed for huge reports. Automatic table binding is also a nice X4J Engine feature, it helps to make maintainable Excel templates because we can avoid tags and scripting for simple tables. Pivot can replace most of sophisticated grouping and summarization scripts or tags.

We believe Excel report should be a simple list with optional pivot because Excel is designed to be an interactive tool,
let user to customize pivots, conditional formating, apply what if analysis. Fancy formatting obfuscates data and it is not practical. There are better formats for small fancy formated documents: PDF with XFA or Word docx with XML binding.