Tag Archives: Vector

Exporting Java DefaultTableModel To Excel Example


DefaultTableModel is one of swing JTable component. This DefaultTableModel class populate JTable data. In other words, JTable data (rows, columns, cells) is a DefaultTableModel instance / object.

However, this post example will show how to populate DefaultTableModel’s column headers, rows, and cells value only. So this example will not showing JTable presentation. FYI, building JTable is pretty easy.
Also DefaultTableModel can be used for storing any kind of tabular data for application purposes without need to presentate its data to JTable.
This post intended to show example for exporting data to excel from DefaultTableModel object.

The library that can build an excel file is ‘Apache POI’. You need to download it through this link http://poi.apache.org/download.html.
The title of this component is ‘the Java API for Microsoft Documents’. I think this title is quite self explanatory. In short, you can write & read MS Documents, including Excel using this component.

The Example

Continue reading