Free Support Forum -

Count the number of images

Hi Team,

how to calculate the number of images present in the word document and print the count of images.please kindly help me to get number of shapes in a document . (1.1 MB)

Thanks & regards,
priyanga G


An image is represented by Shape object in Aspose.Words and you can try something like below to get number of images in document:


Aspose.Words.Document doc = new Aspose.Words.Document("Template.doc");
int imgCount = 0;
foreach (Aspose.Words.Drawing.Shape shape in doc.GetChildNodes(Aspose.Words.NodeType.Shape, true))
       if (shape.HasImage)