(Java操作Word--Aspose Word) 替换指定单元内容

		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("");
					}
			}
		}

你可能感兴趣的:(#,Aspose.Word)