views:

200

answers:

3

On one of our Java application screens, we want to display data loaded from an Excel file on a Excel-like spreadsheet component.

The component has to be able to evaluate the formulas within the spreadsheet and also preserve the general cell formatting as in the loaded Excel file. We have to be able to programmatically change cell values within the spreadsheet.

Being free is a nice-to-have.

Any Java library for that you would recommend?

+1  A: 

Apache POI. It's free but you cannot evaluate the formalas with the help of this lib. BalusC says that you can. I've never tried.

JExcel. It's not free but you can evaluate it for free. It can do all the stuff you've described.

Roman
Not? Uh, what is this then? http://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.html BTW: you forgot Andy Khan's (free!) JExcelAPI http://jexcelapi.sourceforge.net which is considered more efficient than POI.
BalusC
+3  A: 

You can use Apache POI to manipulate Excel documents.

The Apache POI Project's mission is to create and maintain Java APIs for manipulating various file formats based upon the Office Open XML standards (OOXML) and Microsoft's OLE 2 Compound Document format (OLE2). In short, you can read and write MS Excel files using Java. In addition, you can read and write MS Word and MS PowerPoint files using Java. Apache POI is your Java Excel solution (for Excel 97-2008). We have a complete API for porting other OOXML and OLE2 formats and welcome others to participate.

Desintegr
+1  A: 

This might be something:

http://www.jxcell.net/features.htm

Jxcell is a high performance java component which can write, read, calculate Excel compatible files without the need for Microsoft Excel on either the developer or client machines. It was entirely written in 100% pure java code.

Then again, I have no doubts that there are limits to the Excel compatability of this lib, or any other lib you might find or pay for.

Automating excel from your Java application (via COM) might be a better/more complete option.

Alexander Malfait