![]() |
![]() |
What query methods are supported for shapes?
You can perform queries that filter shapes on a page or layer.
To access the methods and properties of the current object, you must prepend the method or property name with the at sign ( @
). Thus, @width
calls the width method of the current object for which the expression is evaluated.
Expressions can be called without specifying the current object. In this case, the @
operator is unavailable.
Shape queries can return values of any of the other supported query object types (see the section What can be queried?). For example, if the expression is evaluated on a shape object in a CorelDRAW document and that shape object exposes a fill property that returns a color object, the following expression can be called to determine whether the current shape has a red fill:
The following query methods are supported for shapes:
Method
|
Description
|
Example
|
Result
|
---|---|---|---|
shape.Name()
|
Returns the name of the current shape
|
@name = 'MyShape'
|
Checks whether the shape is named MyShape
|
shape.Type()
|
Returns a string representing the shape type. The value returned is 'rectangle', 'ellipse', 'curve', 'polygon', and so on.
|
@type = 'polygon'
|
Checks whether the shape is a polygon
|
shape.Fill()
|
Returns the fill object representing the shapes fill
|
@fill.type = 'uniform'
|
Checks whether the shape has a uniform fill applied to it
|
shape.Outline()
|
Returns the outline object representing the shapes outline
|
@outline.color = 'red'
|
Checks whether the shape has a red outline applied to it
|
shape.Width()
|
Returns the width of the shape, in the current unit of measurement
|
@width > {1 in}
|
Checks whether the shape is less than 1 inch wide
|
shape.Height()
|
Returns the height of the shape, in the current unit of measurement
|
@height = {20 mm}
|
Checks whether the shape is 20 mm high
|
shape.Left()
|
Returns the horizontal position of the left edge of the shape on the page
|
@left = {0 mm}
|
Checks whether the left edge of the shape is at the horizontal 0-millimeter mark on the page
|
shape.Right()
|
Returns the horizontal position of the right edge of the shape on the page
|
@right > {8.5 in}
|
Checks whether the right edge of the shape is past the horizontal 8.5-inch mark on the page
|
shape.Top()
|
Returns the vertical position of the top edge of the shape on the page
|
@top = {11 in}
|
Checks whether the top edge of the shape is at the vertical 11-inch mark on the page
|
shape.Bottom()
|
Returns the vertical position of the bottom edge of the shape on the page
|
@bottom < {4 in}
|
Checks whether the bottom edge of the shape is above the vertical 4-inch mark on the page
|
shape.CenterX()
|
Returns the horizontal position of the center of the shape on the page
|
@centerX = {4.25 in}
|
Checks whether the center of the shape is at the horizontal 4.25-inch mark on the page
|
shape.CenterY()
|
Returns the vertical position of the top center of the shape on the page
|
@CenterY = {5.5 in}
|
Checks whether the top center of the shape is at the vertical 5.5-inch mark on the page
|
shape.Colors()
|
Returns an array of colors used in the shapes fill and outline. This array contains only unique colors, so if the fill and the outline have the same color, only one color is returned.
|
@colors.find(cmyk(0,0,0,100))
|
Checks whether the shape contains a CMYK black color
|
|
|
!@color.filter($item.cmyk.k <> 0).empty
|
Checks whether the shape has any colors with a non-empty black color component
|
shape.COM()
|
Returns the COM object for the shape. This allows access to any property and function of the shape object and its subobject methods and properties that are not directly accessible by CQL.
|
(@com.transparency.type = 1)
|
Checks whether the shape has a uniform transparency applied to it. Please refer to the Object Model Reference for details on objects and methods.
|
![]() |
![]() |
![]() |
Copyright 2007 Corel Corporation. All rights reserved.