简体   繁体   中英

How can I get all unloaded images in word document using Aspose.Word

How can I get all unloaded images in the word document which is generated by Aspose.Word. Images like this. Unloaded Image

I have solved my problem. I am posting my answer here, maybe it's helpful to someone other.

    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;                            
                        }
                    }
                 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM