You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Érico <er...@gmail.com> on 2015/01/15 13:44:49 UTC

simple table sample losing format

Hello

I'm trying to code a simple table in docx document but I am losing its
format when I check the document in both OpenOffice(4.1.1) and
LibreOffice(3.6.2.2)

The generated file loses some format depending if I open it with OpenOffice
or with LibreOffice

My code is the following :

          XWPFTable tableOne = doc.createTable();
          tableOne.setWidth(2000);

          XWPFTableRow tableOneRowOne = tableOne.getRow(0);
          tableOneRowOne.getCell(0).setText("Hello");
          tableOneRowOne.addNewTableCell().setText("World");

          XWPFTableRow tableOneRowTwo = tableOne.createRow();
          tableOneRowTwo.getCell(0).setText("This is");
          tableOneRowTwo.getCell(1).setText("a table");

opening the docx with LibreOffice the generated table has a default size
different than the one I have set in the code

in OpenOffice just the text is written, I mean no table is created

My POI version is 3.11

I wonder if may it be some incompatibility with my OpenOffice and
LibreOffice versions

Please I am stuck on this for some time so far

Thks
Érico