【发布时间】:2018-02-03 05:32:48
【问题描述】:
我正在使用以下代码在 xwpf 中的 Apache Poi 中创建一个表:
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 to be populed here*/
我找不到任何方法可以将表格对齐到页面的左侧、中心或右侧。有什么方法可以做到这一点吗?
第一行的内容也应该是粗体。有什么方法可以将标题设置为粗体吗?
【问题讨论】:
标签: apache-poi xwpf