I am working on a small method to throw a flag when a Word document has shapes in it. I already have a method that uses the LayoutEnumerator class to list everything in the document.
The best way of finding shapes I have right now is to get the kind of the LayoutEnumerator.
For example:
LayoutEnumerator e = new LayoutEnumerator(doc);
if(e.Kind == "SHAPE") //do something;
This doesn't get me far because a lot of things are also considered shapes. Also, 'if(e.Type == ShapeType.Line)' doesn't work either.
Does anybody know what is the best way I could find shapes in a document?
Thanks for your inquiry. The Shape class represents an object in the drawing layer, such as an AutoShape, textbox, freeform, OLE object, ActiveX control, or picture. Here is how you can get all shapes from the document node, but you can do this for any smaller node too, for example get shapes from a single section or a paragraph.