WorkBook Readers and Writers
ModelIO imports and exports TableModel to multiple formats, such as Excel xls, Excel xml, PDF.
JDataGrid can import and export the standard spreadsheet file format(xls, pdf, xml).
Import and Export(xls, pdf, xml)
JDataGrid can import and export the standard spreadsheet file format, such as Excel xls file, Excel xml file, comma separated file, you can also export the spreadsheet to Web page, PDF file.
Import Model

Code Samples:

File f = new File("tmp.xls");
WorkBook book = ModelIO.readWorkBook(f, xls, null);
Export Model

Code Samples:

File f = new File("tmp.xls");
WorkBook book = createWorkBook();
ModelIO.writeWorkBook(book, "xls", null, f);
XLS Format

The ModelIO provides the support for importing or exporting EXCEL file, it requires third-party Java class library. Currently both the HSSF of the Apache POI and JExcelAPI are supported.

Download Apache POI HSSf from:

http://jakarta.apache.org/poi/hssf/index.html

Download JExcelAPI from:

http://jexcelapi.sourceforge.net/
Note:Please ensure putting these Java class library in the classpath.

 

Code Samples:

// import model
File f = new File("tmp.xls");
WorkBook book = ModelIO.readWorkBook(f, xls, null);
// export model
File f = new File("tmp.xls");
WorkBook book = createWorkBook();
ModelIO.writeWorkBook(book, "xls", null, f);