XWPFDocument doc = new XWPFDocument();

        //column width in Twentieths of a Point
        int[] cols = {2000, 2000, 2000};
        XWPFTable table = doc.createTable(3, 3);
        for(int i = 0; i < table.getNumberOfRows(); i++){
            XWPFTableRow row = table.getRow(i);
            int numCells = row.getTableCells().size();
            for(int j = 0; j < numCells; j++){
                XWPFTableCell cell = row.getCell(j);

cell.getCTTc().addNewTcPr().addNewTcW().setW(BigInteger.valueOf(cols[j]));
            }
        }


Yegor

On Thu, Nov 15, 2012 at 8:30 PM, Bart W Jenkins <[email protected]> wrote:
> I'm using POI to generate a .docx word file using OOXML and am having trouble 
> figuring out how to set the width of an individual column in a table.  Can 
> someone help?
>
> Bart

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to