Understanding the CorelDRAW object model : Working with shapes : Searching for shapes |
In your macros, you can include queries that search for shapes that have specific shape properties, fill properties, outline properties, or color properties. To do this, you use Corel Query Language (CQL) in conjunction with one of the following methods:
• |
Shape.Evaluate returns the result of a given expression that evaluates the properties of the current shape
|
• |
Shapes.FindShape returns a single shape that has the specified properties
|
• |
Shapes.FindShapes returns, as a shape range, all shapes that have the specified properties
|
You can specify the shape properties for which to search. For example, the expression ActiveShape.Evaluate("@name") searches searches the Name property of all selected shapes.
Consider the following VBA code sample, in which the Type property and the Width property are used to select all rectangles that are wider than two inches:
ActivePage.Shapes.FindShapes(Query := "@type = 'rectangle' and _ |
@width > {2 in}").CreateSelection |
For comprehensive information on using CQL, see Including queries in macros.
Copyright 2013 Corel Corporation. All rights reserved.