Excel Exporter - Vaadin Add-on Directory
It is a single point solution providing consistent and configurable support for exporting data of Vaadin Table, Tree Table and Grid in Excel format.
Let's first discuss why do we need this add on?
1) Exporting the screen data is a frequent task required in most of the applications. There are several helper technologies such as POI which help us in bringing the Export feature in place but a developer needs to take it up every time he wants to implement.
2) Vaadin providing so many components for representation of data such as Table, Tree Table and Grid, which again raises a need for a utility that is easy and configurable to be used with varied component without the pain of writing the logic to generate the Excel.
3) A consistent excel format throughout the application which would enhance user experience.
4) Can be integrated with any Vaadin application with just few lines of configuration code.
Now Let's discuss what this add on does?
This add-on utility takes various components like the Tree Table, Grid and Table as inputs and directly generates an excel in the required formats such as .XLS or .XLSX.
It is highly configurable and provides configuration at three levels namely File Level, Sheet Level, Component Level.
For each file you can configure
- List of Sheets
- Export File Name
- Generated By
- Export Type
- Export Extension
For each sheet you can configure
- Sheet Name
- Report Title Row
- Generated By Row
- List of Components inside the sheet
- Field Group - for showing filters selected on the screen for the selected data
- Additional Header Info - HashMap for custom data
- Date Format
- Number Formats
- XSSFCellStyle for each content section of the screen
Note that the Number formats by itself manages the thousand seperator and decimal point handling for different locales. For Eg: For English the decimal point is (.) and thousand seperator is (,), but for German locale it is the reverse. But the code handles it by its own.
For each component you can configure
- Tree table or Grid or Table
- Visible properties
- Properties requiring date formatting
- Properties requiring Float formatting
- Properties requiring Integer formatting
- Column Header Texts
- Component Header and Content Styles
- Column Freeze and Header Freeze feature
- Provide Column Level Configurations
-- Datatype
-- Suffix
-- Prefix
-- Custom Column Generator
-- Thousand Separators in case of Number
- Multiple Header Rows with cell merging option
- Multiple Footer Rows with cell merging option
However, if none of these are specified, it would generate the Excel with default values and styles.
What dependencies are required?
JDK 1.7 or above
POI 3.9
POI-OOXML 3.9
Apache Commons IO library (http://commons.apache.org/io/) v2.2
net.karneim.pojobuilder 3.4.0 and above
Who developed it?
Kartik Suba @ Direction Software Solutions, India.
For Client: Bonprix Handelsgesellschaft mbH
Contact on Skype @ k.suba@direction.biz or kartik.suba for quick assistance.
Are there any Future Up gradation Plans?
- Specifying a row header which can allow horizontal data as well.
- Export of selected records wherever applicable
- Legend for better understanding
Source Code
Author Homepage
Online Demo
Issue Tracker
Excel Exporter version 1.0.3
Added Column Formatter Logic
These would allow the user to give custom formatting to the Excel columns.
Also developed three formatters as built in formatters namely
SuffixColumnFormatter(String suffix) // can add suffix to the container/model value such as $, %, kg etc...
PrefixColumnFormatter(String prefix // can add prefix to the container/model value
BooleanColumnFormatter(String trueValue, String falseValue) // Give meaningful alias to true and false like Yes/No, Active/De-Active etc.. Requires the column to be also set withBooleanFormattingProperties
Note: For columns mentioned in withFloatFormattingProperties and withIntegerFormattingProperties, the above formatting gets applied after the Integer and Float formatting is performed on the container/model value.
Updated the Demo Project to showcase the same.
Excel Exporter version 1.0.4
Added ComponentHeaderConfiguration and ComponentFooterConfiguration
These would allow the user to configure multiple headers and footers for each component.
The ComponentHeaderConfiguration provides support for Grid.HeaderRow so in case you have appended headers in your grid, you can pass them directly to the header configuration.
However, it also supports custom header through String[]
You can also merge the header cells by specifying the start property, end property and display string in the MergedCell bean.
Similar support is available for ComponentFooterConfiguration
Updated the Demo Project to showcase the same. Also you can refer to the advance snipped section for example.
Excel Exporter version 1.0.6
Added support for nested properties in case of BeanItemContainer.
Resolved issues raised in git
https://github.com/bonprix/vaadin-excel-exporter/issues/3
https://github.com/bonprix/vaadin-excel-exporter/issues/9
https://github.com/bonprix/vaadin-excel-exporter/pull/16
Excel Exporter version 2.0
upgraded to Vaadin 8
please check new apis for cellstyle generation, if needed
Excel Exporter version 1.0.7
- Allowed specifying data type for each column with the help of ColumnConfig class, thereby opening the scope of excel formulas on numbers and dates.
- Removed Suffix and Prefix column formatter classes instead allowed optional configuration in the ColumnConfig itself.
- Made the current DateTime optional in the Excel filename.
Excel Exporter version 1.0.8
- Bug Fix: Datatype formatting was working only on odd rows. Now it has been fixed. No code change required.