Using Apache Poi to analyze a table in a table in a text document

I managed to get the tables in a text document using getTablesIterator () in XWPFDocument. But is there a way to get the table inside the table?

Thanks Advance, Joel

+5
source share
1 answer

In .docx, the “Table” does not directly contain other tables, but a table cell can be used. Thus, you cannot query the table for your nested tables, you need to get each cell and check them.

From XWPFTable, get your XWPFTableRow instances, and then from there XWPFTableCell. Then you can call XPWFTableCell.getTables () to get any tables nested in this cell.

+3
source

All Articles