How can I get all the uploaded images in a text document using Aspose.Word

How can I get all the uploaded images in a word document that is generated by Aspose.Word. Similar images. Downloaded image

+4
source share
1 answer

I solved my problem. I am posting my answer here, maybe this is useful to someone else.

    var doc = new Document();
    var shapeCollection = doc.GetChildNodes(Word.NodeType.Shape, true);

                // getting all images from Word document. 
                foreach (Shape shape in shapeCollection)
                {                        
                    if (shape.ShapeType == ShapeType.Image)
                    {
                       //Unloaded image alwasy have 924 imagebytes
                        if (shape.ImageData.ImageBytes.Length == 924)
                        {
                            shape.Width = 72.0;
                            shape.Height = 72.0;                            
                        }
                    }
                 }
+3
source

Source: https://habr.com/ru/post/1668354/


All Articles