OberonPlace.com Forums

OberonPlace.com Forums (http://forum.oberonplace.com/index.php)
-   CorelDRAW/Corel DESIGNER VBA (http://forum.oberonplace.com/forumdisplay.php?f=16)
-   -   How to use a CQL on C# (4GL Language) (http://forum.oberonplace.com/showthread.php?t=7125)

ljesus7 18-08-2010 02:58

How to use a CQL on C# (4GL Language)
Hello~ It's a hotter than I remember.. wow

As you can see, How do I wonder about using a CQL on C#(4GL)
If somebody who have solved a problem here, would you tell me a way to
use a CQL

Thks Best Regards...

shelbym 20-08-2010 13:09

CQL and C#
Here is a simple example of how to use C# and CQL. I tested this example with VSTO and CorelDRAW X5. The example creates three rectangles then selects one of them using CQL.

Document doc = app.CreateDocument();
Shape sRectLarge = doc.ActiveLayer.CreateRectangle2(0, 0, 3, 3, 0, 0, 0, 0);
Shape sRectMedium = doc.ActiveLayer.CreateRectangle2(4, 0, 1, 1, 0, 0, 0, 0);
Shape sRectSmall = doc.ActiveLayer.CreateRectangle2(6, 0, .5, .5, 0, 0, 0, 0);

sRectLarge.Fill.UniformColor.CMYKAssign(0, 100, 100, 0);
sRectMedium.Fill.UniformColor.CMYKAssign(0, 100, 100, 0);
sRectSmall.Fill.UniformColor.CMYKAssign(0, 100, 100, 0);

ShapeRange srFoundShapes = doc.ActivePage.Shapes.FindShapes(null, cdrShapeType.cdrNoShape, true, "@width = {1 in} and @fill.color = cmyk(0,100,100,0)");

Best of luck,


ljesus7 26-08-2010 06:09

Thanks For your Reply

// Shape Error Check
if (corel.ActiveDocument.ActivePage.Shapes.FindShapes(string.Empty, cdrShapeType.cdrNoShape, true,
"@type='3DObject' or
@type='ArtisticMediaGroup' or
@type=BevelGroup or
@type=BlendGroup or
@type=Connector or
@type=ContourGroup or
@type=CustomEffectGroup or
@type=CustomEffectGroup or
@type=DropShadowGroup or
@type=ExtrudeGroup or
@type=HTMLActiveObject or
@type=HTMLFormObject or
@type=LinearDimension or
@type=MeshFill or
@type=OLEObject or
@type=Perfect or
@type=Symbol or
@type=text").Count != 0)
                throw new Exception();

            if (corel.ActiveDocument.ActivePage.Shapes.FindShapes(string.Empty, cdrShapeType.cdrNoShape, true, "@color.IsCMYK = false").Count != 0)
                throw new Exception();

 Top of the page has a type check and color check using a CQL, but I don't know what Effect Check
 As you can see, CorelDraw have a lot of many type object.. so I would like to know how to find a lot of many object information using a CQL
 For example.
 CQL Manual
 Returns an array of colors used in the fill and the outline of the shape.
 This array contains only unique colors, so if both the fill and the outline have the same color, only one color will be returned
 @colors.find(cmyk(0,0,0,100)) => finds if the shape contains a CMYK black color
 !@color.filter($item.cmyk.k <> 0).empty => Finds if the shape has any color that has non-empty black color component.

                if (sh.Shapes.FindShapes(string.Empty, cdrShapeType.cdrNoShape, true, "@color.cmyk.k <> 0 and @fill.Type = 'uniform'").Count > 0)
                    color = 1;

                if (sh.Shapes.FindShapes(string.Empty, cdrShapeType.cdrNoShape, true, "(@color.cmyk.c + @color.cmyk.m + and @color.cmyk.y + @color.cmyk.k = 0) or
                (@color.cmyk.c + @color.cmyk.m + and @color.cmyk.y) and  @fill.Type = 'uniform'").Count > 0)
                    color = 4;

How to Check a Black Color [range 0 to 100] , How to check a CMYK Color without @color.IsCmyk , How to check a object included Effect [Blend, Extrude, PowerClip, Fountain, Etc]
Thank For you Replay again

All times are GMT -5. The time now is 00:38.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com