Java API to read, write and modify Excel spreadsheets
If you are looking for generating MS office Excel documents in Java, then Java API for Excel is a good option.
The reading of spreadsheet is as simple as the following piece of code.
Sheet sheet = workbook.getSheet(0);
Cell a1 = sheet.getCell(0,0);
Cell b2 = sheet.getCell(1,1);
Cell c2 = sheet.getCell(2,1);
String stringa1 = a1.getContents();
String stringb2 = b2.getContents();
String stringc2 = c2.getContents();
Similarly, writing the spreadsheet is as simple as:
WritableSheet sheet = workbook.createSheet("First Sheet", 0);
Label label = new Label(0, 2, "A label record");
sheet.addCell(label);
Number number = new Number(3, 4, 3.1459);
sheet.addCell(number);
...
// All sheets and cells added. Now write out the workbook
workbook.write();
workbook.close();
There much more you can do apart from just reading, writing or modifying the excel files. Click the title of this post to explore more.
[Resource-Type: Library; Category: Java; XRating: 4]








5 Comments:
A link to the API would have been nice.
10:02 AM
Hi,
Please refer title of this post.
11:03 AM
Good one but for non-windows! Would be nice to have one for windows environment to manipulate MS Excel.
8:36 AM
hi, this is for a test purpose
12:57 PM
SpreadsheetConverter to Java generates a JavaServer Page and a JavaBeans for each Excel spreadsheet that it converts. These files is suitable for use on any Java-based server, for example a J2EE solution, or inside a Java applet. The JSP-page takes the users input, feed it into the bean, and then display the result. It will also be possible to use the Java-bean as a stand-alone object. You can download and try it by clicking on 'Downloads' to the right.
2:40 AM
Post a Comment
<< Home