获取 XSLFTable
XSLFTable t = null;
for (XSLFShape shape : slide) {
if (shape instanceof XSLFTable) {
t = (XSLFTable) shape;
r = t.getRows();
}
}
添加行和单元格
XSLFTableRow titleRow = tbl.addRow();
titleRow.setHeight(50);
XSLFTableCell titleCell1 = titleRow.addCell();
XSLFTextParagraph p1 = titleCell1.addNewTextParagraph();
p1.setTextAlign(TextAlign.CENTER);
XSLFTextRun r1 = p1.addNewTextRun();
r1.setText("Column title");
r1.setBold(true);
r1.setFontColor(new Color(0, 104, 145));
titleCell1.setFillColor(new Color(190, 230, 245));
r1.setFontSize(25.0);
titleCell1.setVerticalAlignment(VerticalAlignment.MIDDLE);
删除行
t.getCTTable().getTrList().remove(t.getNumberOfRows()-1); //Remove the last row from table.