You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Christopher Cheng <ch...@gmail.com> on 2012/11/22 02:17:04 UTC

how to set table width or column width in XWPFTable ?

I am trying to add a new table to new word document, but I am unable to set
the width. What's the proper way to do it?

XWPFDocument document = new XWPFDocument();
XWPFTable table = document.createTable(2, 2);
table.setWidth(2000);
XWPFTableRow row = table.getRow(0);
row.getCell(0).setText("1");
row.getCell(1).setText("2");
row = table.getRow(1);
row.getCell(0).setText("3");
row.getCell(1).setText("4");