Home/ Reference/ Find & Traverse

coll.FindShapes(query, shapeType, recursive)

The main search call. query is a string condition (empty means anything), shapeType takes a number or a cdrShapeType, recursive decides whether to descend. It runs s

Signature

coll.FindShapes(query, shapeType, recursive)

Notes

The main search call. query is a string condition (empty means anything), shapeType takes a number or a cdrShapeType, recursive decides whether to descend. It runs server-side, which makes it far faster than looping in Python.

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
page = doc.ActivePage

# FindShapes(query, shape type, recurse)
#   query  : empty string means no filter
#   type   : 6=text 7=group 5=bitmap 3=curve 1=rectangle 2=ellipse
#   recurse: True walks into groups and containers
result = page.FindShapes("", 6, True)
print("Found ", result.Count, " text object(s)")

About this section: Find & Traverse

Find & Traverse — walking the shape tree.

Other entries in this section