Error: can only iterate over an array or an instance of java.lang.Iterable

I assume Nodecollection is a com.aspose.words.NodeCollection.

If you want to use the foreach syntax you better do:

Node[] shapesArray = shapes.toArray();
for (Node node : shapesArray ){ ...

Leave a Comment