Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
JODF
>
Tutorial
> Simple spreadsheet
The following example shows you how to create simple spreadsheet.
import com.independentsoft.office.odf.Cell; import com.independentsoft.office.odf.Spreadsheet; import com.independentsoft.office.odf.Table; public class Example { public static void main(String[] args) { try { Table table1 = new Table(); table1.set(1, 1, new Cell(1)); table1.set(2, 1, new Cell(2)); table1.set(3, 1, new Cell(3)); table1.set(4, 1, new Cell(4)); table1.set(5, 1, new Cell(5)); table1.set("A", 2, new Cell(1)); table1.set("B", 2, new Cell(2)); table1.set("C", 2, new Cell(3)); table1.set("D", 2, new Cell(4)); table1.set("E", 2, new Cell(5)); table1.set("A3", new Cell(1)); table1.set("B3", new Cell(2)); table1.set("C3", new Cell(3)); table1.set("D3", new Cell(4)); table1.set("E3", new Cell(5)); Spreadsheet spreadsheet = new Spreadsheet(); spreadsheet.getTables().add(table1); spreadsheet.save("c:\\test\\output.ods", true); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } } }
Need help? Ask our developers:
Name*
Email*
Message*