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.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.