Hi JOpenDocument developpers,

     I need to merge cells , But while trying merging cells using merge
() method , only the cells values are get replaced , merging doesn't
happen.
     I need a clear example to do this.

     Please check this code, and find out whether i have used wrong
code .
     Also please sent the correct example to merge cells.

    public class CreateFile {

    public static void main(String[] args) {
            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", "TestCase");
                Table<ODSingleXMLDocument> table = new
Table<ODSingleXMLDocument>(single, elementTable);
                table.duplicateRows(1, 1, 20);
                for (int i = 2; i < 20; i++) {
                    for (int j = 0; j < 4; j++) {
                        table.getCellAt(j, i).setValue(i);
                    }
                }
                table.merge(table.getTableModel(0, 0,2,2) , 0, 2);
                single.saveAs(outFile);
    }
}

Reply via email to