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
Post a Comment