Hi JOpenDocument developpers,

I need to create a table based on the template file.

In template , I created a table which has two rows and
i manually assigned each row as center alignment.

while generating table from the template, table is  generated
but the row values are in Left alignment rather than center aligment
which i had assigned in template file.

I have attached the  template file as input.odt and it's
output as output.odt  file.
Please find the files which attached at url 
http://groups.google.com/group/jopendocument/files

I used the following code

  public class CreateFile {

    public static void main(String[] args) {
        try {
            File templateFile = new File("input" + ".odt");
            File outFile = new File("output" + ".odt");
            final ODSingleXMLDocument single = new ODPackage
(templateFile).toSingle();
            Element elementTable = single.getDescendantByName
("table:table", "personal");
            Table<ODSingleXMLDocument> table = new
Table<ODSingleXMLDocument>(single, elementTable);
            table.getCellAt(0, 1).setValue("1");
            table.getCellAt(1, 1).setValue("jai");
            table.getCellAt(2, 1).setValue("12 North Car Street");
            table.getCellAt(3, 1).setValue("123456789");
            single.saveAs(outFile);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}

Regards,

Jai

Reply via email to