62,614
社区成员
发帖
与我相关
我的任务
分享
XWPFDocument xwp = new XWPFDocument(in);
XWPFTable tab = xwp.createTable(2, 2);
tab.setCellMargins(50, 0, 50, 3000);// top, left, bottom, right
tab.getRow(0).getCell(0).setText("字段一:");
tab.getRow(0).getCell(1).setText("字段二:");
tab.getRow(1).getCell(0).setText("字段三:");
tab.getRow(1).getCell(1).setText("字段四:");
System.out.println(xwp.getTables().size());
xwp.insertTable(0, tab);
System.out.println(xwp.getTables().size());
XWPFParagraph paragraph = xwp.getParagraphs().get(0);
paragraph.removeRun(0);
paragraph.insertNewRun(0).setText("字段五");
xwp.write(out);