You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Felix Jung <fe...@rocketmail.com> on 2015/08/24 11:26:11 UTC

Nested Table in XWPF (*.docx)

Hi, i would create a docx-document with a nested table.
But it dosn't work.

The nested table is alway append to the outer parent table.

What can i do, or where is my failure?

Here is my code:

                XWPFDocument document = new XWPFDocument();
                XWPFTable tableOne = document.createTable();
                XWPFTableRow tableOneRow1 = tableOne.getRow(0);
                XWPFTableRow tableOneRow2 = tableOne.createRow();
                tableOneRow1.getCell(0).setText("Test");
                tableOneRow1.addNewTableCell();
                tableOneRow1.getCell(1).setText("Test");
                tableOneRow2.getCell(0).setText("Test");
                tableOneRow2.addNewTableCell();
                tableOneRow2.getCell(1).setText("include nestedTable");

                XWPFTable tableTwo = document.createTable();
                XWPFTableRow tableTwoRow1 = tableTwo.getRow(0);
                tableTwoRow1.getCell(0).setText("nestedTable");
                tableOneRow2.getCell(1).insertTable(1, tableTwo);

The output is 
<http://apache-poi.1045710.n5.nabble.com/file/n5719918/nestedTable.png> 

Thank you wishes

Felix



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Nested-Table-in-XWPF-docx-tp5719918.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org