Document srcDoc = new Document(srcDocPath);
//获取第一个表格
Table table = (Table)srcDoc.getChild(NodeType.TABLE, 0, true);
RowCollection rows = table.getRows();
for (int i = 1; i < rows.getCount(); i++) {
Row row = rows.get(i);
Cell cell = row.getCells().get(5);
if(null != cell ){
String text = row.getCells().get(3).getText();
if(null != text && !"".equals(text)){
//设置新内容
cell.getFirstParagraph().getRuns().get(0).setText("");
}
}
}
(Java操作Word--Aspose Word) 替换指定单元内容
最新推荐文章于 2024-05-15 11:01:43 发布