0
我在Aspose word模板中有一个现有的表格,我想改变单元格内文本的字体颜色。我怎样才能实现它?如何在Java中的Aspose Word中更改现有表格单元格的字体颜色?
CellCollection cellList = row.getCells()
def i = 0
Run run;
Cell cell = cellList.get(i)
我是Aspose Word的新手。
我在Aspose word模板中有一个现有的表格,我想改变单元格内文本的字体颜色。我怎样才能实现它?如何在Java中的Aspose Word中更改现有表格单元格的字体颜色?
CellCollection cellList = row.getCells()
def i = 0
Run run;
Cell cell = cellList.get(i)
我是Aspose Word的新手。
请使用下面的代码示例更改表格单元格内文本的颜色。希望这可以帮助你。
//Load the document
Document doc = new Document(MyDir + "in.docx");
//Get the first table in the document
Table table = (Table)doc.getChild(NodeType.TABLE, 0, true);
//Get the first cell of first row
Cell cell = (Cell)table.getRows().get(0).getCells().get(0);
//Change the color of text
for (Run run : (Iterable<Run>)cell.getChildNodes(NodeType.RUN, true))
{
run.getFont().setColor(Color.BLUE);
}
//Save the document
doc.save(MyDir + "Out.docx");
我使用Aspose作为Developer evangelist。
谢谢。有效。 :) – sgiri