It was easy, just:

cell.getOdfElement().appendChild( nestedTable.getOdfElement() );

On 4/5/2018 4:45 PM, David Michal wrote:
Hi.

I am Sorry, I am still beginner with the great odftoolkit library.

I am struggling on %subj.

I have code like:

Table table = getParentTable(); // this is the table I want to add some new row and another table into

Row subTableRow = table.appendRow();
CellRange cellRange = table.getCellRangeByPosition( 0, subTableRow.getRowIndex(), subTableRow.getCellCount() - 1, subTableRow.getRowIndex() );
cellRange.merge();

that works fine, I have a table with some new row with only one cell. Now how to add new table as a content of the cell?

I'm creating new nested table by:

TableTableElement ttEl = ( TableTableElement ) privateMethodToGetTableTemplate().getOdfElement().cloneNode( true );
Table nestedTable = Table.getInstance( ttEl );

Cell cell = table.getCellByPosition( 0, subTableRow.getRowIndex() );

And missing this part:

cell.addTheTableSomehow(nestedTable);

Thanks for any help in advance,
David

Reply via email to