Hi,
I am trying to get all the shapes from one of my word document with the below code, but I was always getting NodeCollection with zero items. Am I doing any thing wrong here?
Document d = new Document(“E:\imgtest.docx”);
NodeCollection nd = d.GetChildNodes(NodeType.Shape, true);
I have attached the sample document here.
Hi Srinu,
Thanks for your inquiry.
Images in Word documents are either represented by Shape nodes or by DrawingML nodes when loading into Aspose.Words’ DOM. The image found in your document is actually represented by DrawingML node. Please read the members of DrawingML and Shape class from here:
http://www.aspose.com/docs/display/wordsnet/Shape+Members
http://www.aspose.com/docs/display/wordsnet/DrawingML+Members
Please use the following code example to get the DrawingML nodes. Please let us know if you have any more queries.
//Load word document
Document doc = new Document(MyDir + "imgtest.docx");
NodeCollection drwaingml = doc.GetChildNodes(NodeType.DrawingML, true);