Apache poi xwpf table alignment -


i creating table in apache poi in xwpf using below code :

          xwpftable table = doc.createtable(countrows1+1,4);           table.getcttbl().gettblpr().unsettblborders();           table.setinsidehborder(xwpftable.xwpfbordertype.dashed, 0,0,null);           table.setinsidevborder(xwpftable.xwpfbordertype.dashed,0,0, null);           /* table header */            table.getrow(0).getcell(0).settext("column1");           table.getrow(0).getcell(1).settext("column2");           table.getrow(0).getcell(2).settext("column3");           table.getrow(0).getcell(3).settext("column");            /* other rows populed here*/ 

i not find method using align table left, centre or right of page .is there way this?

also content of first row should in bold . there method set header bold ?

you can align table using following function

public void settablealignment(xwpftable table, stjc.enum justification) {     cttblpr tblpr = table.getcttbl().gettblpr();     ctjc jc = (tblpr.issetjc() ? tblpr.getjc() : tblpr.addnewjc());     jc.setval(justification); } 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -