Goldy Lukka
Posts: 1008
Nickname: xyling
Registered: Jan, 2004
Goldy Lukka is a Java Developer and an Entrepreneur. He is Founder of xyling.com.
Java API to read, write and modify Excel spreadsheets
Posted: Dec 12, 2005 11:04 PM
Advertisement
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]
Read: Java API to read, write and modify Excel spreadsheets