You are viewing a plain text version of this content. The canonical link for it is here.
Posted to odf-users@incubator.apache.org by David Michal <mi...@alis.cz> on 2018/04/05 10:43:30 UTC

How to get a table from another's table cell?

Hi,

I have a table in document and in some cell there is an another 
sub-table. How can I get it?

I have this code:

Table table = document.getTableByName( tableName );

Cell cell = table.getCellByPosition( colIndex, rowIndex );

// and now, how to get a sub-table if there is some in the cell ?

Table subTable = cell.someMethod().someOtherMethod().......

Thanks,
David


Re: How to get a table from another's table cell?

Posted by Svante Schubert <sv...@gmail.com>.
Hello David,

when you take a look at the source code of
document.getTableByName( tableName );
You see that it always search through the top level elements of the content.

Therefore, you need to enhance this or rewrite it if you like to have
support for nested tables.
Instead of running through all the content every time, I would suggest
rather create a map during parsing SAX and intercept whenever a map is
being renamed and/or created.

All the best,
Svante

ᐧ

2018-04-05 12:43 GMT+02:00 David Michal <mi...@alis.cz>:

> Hi,
>
> I have a table in document and in some cell there is an another sub-table.
> How can I get it?
>
> I have this code:
>
> Table table = document.getTableByName( tableName );
>
> Cell cell = table.getCellByPosition( colIndex, rowIndex );
>
> // and now, how to get a sub-table if there is some in the cell ?
>
> Table subTable = cell.someMethod().someOtherMethod().......
>
> Thanks,
> David
>
>