![]() |
|
#1
|
|||
|
|||
![]()
I have some code for prepress my work but there is some strange behaviour with one logo (attach file). The part of code this:
Dim srAll As ShapeRange Dim shprgb As Shape Dim ff As FountainFill Set srAll = ActivePage.Shapes.All srAll.ConvertToCurves For Each shprgb In srAll If shprgb.Fill.Type = cdrUniformFill Then If shprgb.Fill.UniformColor.Type = cdrColorRGB Then shprgb.Fill.UniformColor.ConvertToCMYK End If ElseIf shprgb.Fill.Type = cdrFountainFill Then Set ff = shprgb.Fill.Fountain For i = 0 To ff.Colors.Count + 1 ff.Colors(i).Color.ConvertToCMYK Next i End If Next shprgb make shape with RGB Fill white be RGB Fill Green (outline color). Need some help to understand where is mistake? |
#2
|
||||
|
||||
![]()
It looks like the problem is that your logo is a group but you are not looking into groups. You just go through the top level objects on the page. You need to look through children of a group to make sure you inspect individual objects.
Also you can call "Shape.CanHaveFill" to make sure you are not trying to apply a fill to an object (like a group) that can't have a fill in the first place. You might use Shapes.FindShapes method to filter out only the objects that actually have RGB colors in them. Here is a modified macro that does all this: Code:
Public Sub TestFill() Dim srAll As ShapeRange Dim shprgb As Shape Dim ff As FountainFill Dim ffc As FountainColor Set srAll = ActivePage.Shapes.All srAll.ConvertToCurves For Each shprgb In ActivePage.Shapes.FindShapes(Query:="!@colors.filter($item.type='rgb').empty") If shprgb.CanHaveFill Then If shprgb.Fill.Type = cdrUniformFill Then If shprgb.Fill.UniformColor.Type = cdrColorRGB Then shprgb.Fill.UniformColor.ConvertToCMYK End If ElseIf shprgb.Fill.Type = cdrFountainFill Then Set ff = shprgb.Fill.Fountain For Each ffc In ff.Colors ffc.Color.ConvertToCMYK Next ffc End If End If Next shprgb End Sub |
#3
|
|||
|
|||
![]()
Thank you very much!
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Filling Each Letter with a Different Color. | 11jeremy | CorelDRAW/Corel DESIGNER VBA | 3 | 30-09-2008 12:28 |
How to select object inside another object | jukos | General | 4 | 24-10-2005 21:27 |
Filling Freehand Objects | rail | CorelDRAW/Corel DESIGNER VBA | 1 | 17-02-2005 15:34 |
Need help connecting to database and filling combo box | CamWest | CorelDRAW/Corel DESIGNER VBA | 6 | 22-12-2004 13:30 |
Filling in DXF | Cagnulein | CorelDRAW CS | 1 | 28-05-2004 13:49 |