【发布时间】:2016-08-12 01:51:35
【问题描述】:
是否可以使用 aspose word java API 将公式添加到表格中。 我编写了一个代码来生成聚合行,但我搜索了相关的公式内容控件。
我找到了 API FieldFormula,这个字段 API。我们可以在 Cell 中添加字段吗?
private void prepareAggregateRow(Table table, Row headerRow, Map<String, WsAttribute> attrValueMap, List<Attribute> attrDefs) throws Exception{
Row totalRow = (Row)headerRow.deepClone(true);
for (Attribute attribute : attrDefs) {
WsAttribute wsAttribute = attrValueMap.get(attribute.getName());
Cell cell = totalRow.getCells().get(attribute.getIdx());
Run run = (Run)cell.getChild(NodeType.RUN, 0,true);
if(wsAttribute!=null && wsAttribute.getValue()!=null) {
run.setText(wsAttribute.getValue());
} else {
run.setText("");
}
}
table.appendChild(totalRow);
}
【问题讨论】:
-
这似乎是 Aspose.Words 问题而不是 Aspose.Cells。请删除 Aspose.Cells 标签并添加 Aspose.Words 标签,以便 Aspose.Words 社区可以帮助您解决此问题。谢谢。
标签: java aspose aspose-cells