日曜日, 4月 12, 2009

ODFDOM Samples

ODFDOM is an OpenDocument (ODF) framework. It's purpose is to provide an easy common way to create, access and manipulate ODF files, without requiring detailed knowledge of the ODF specification. It is designed to provide the ODF developer community an easy lightwork programming API, portable to any object-oriented language.

Some ODFDOM Samples

odf4j sample

Here´s the modified code which actually works:


package org.openoffice.odf.tools;

import java.util.Vector;
import javax.swing.table.DefaultTableModel;
import org.openoffice.odf.spreadsheet.SpreadsheetDocument;

public class Test {

public static void main(String[] args) throws Exception {

SpreadsheetDocument doc = new SpreadsheetDocument();
DefaultTableModel model = new DefaultTableModel();

model.addColumn("Column A");
model.addColumn("Column B");

Vector row = new Vector();
row.add( "foo" );
row.add( new Integer( 1 ) );
model.addRow( row );

doc.addSpreadsheet( "Test1", model, false );
doc.deleteSpreadsheet("Sheet1");

doc.save( "test.ods" );
doc.close();

}
}



jOpenDocument A pure Java library for OASIS Open Document files manipulation

0 件のコメント: