Hi,
I’m looking to migrate to Aspose.Words for Java 10.1 from an early release (I think 3.3).
When I run the following code I get an EmptyStackException. The method searches document for a cell containing merge field.
private Cell GetCellByMergeFieldName(String mergeFieldName) throws Exception
{
Cell cell = null;
NodeCollection nodeCollection = document.getChildNodes(NodeType.FIELD_START, true, false);
Iterator iterator = nodeCollection.iterator();
while (iterator.hasNext())
{
FieldStart node = (FieldStart) iterator.next();
if ((node.getFieldType() == FieldType.FIELD_MERGE_FIELD) && (node.getNextSibling().toTxt().indexOf(mergeFieldName)>= 0))
{
cell = (Cell) node.getAncestor(NodeType.CELL);
break;
}
}
return cell;
}
java.util.EmptyStackException
at java.util.Stack.peek(Stack.java:79)
at com.aspose.words.atv.visitRun(TxtWriter.java: 113)
at com.aspose.words.Run.accept(Run.java: 88)
at com.aspose.words.atv.x(TxtWriter.java: 67)
at com.aspose.words.Document.b(Document.java: 1298)
at com.aspose.words.Node.toTxt(Node.java: 571)
Thanks, Omnium