OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 24-11-2010, 00:59
0meg@ 0meg@ is offline
Member
 
Join Date: Nov 2010
Posts: 37
Default Mistake that filling object

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?
Attached Files
File Type: zip testEmail.zip (24.6 KB, 180 views)
Reply With Quote
  #2  
Old 27-11-2010, 13:43
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

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
Reply With Quote
  #3  
Old 01-12-2010, 02:17
0meg@ 0meg@ is offline
Member
 
Join Date: Nov 2010
Posts: 37
Default

Thank you very much!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Filling Each Letter with a Different Color. 11jeremy CorelDRAW/Corel DESIGNER VBA 3 30-09-2008 13:28
How to select object inside another object jukos General 4 24-10-2005 22:27
Filling Freehand Objects rail CorelDRAW/Corel DESIGNER VBA 1 17-02-2005 16:34
Need help connecting to database and filling combo box CamWest CorelDRAW/Corel DESIGNER VBA 6 22-12-2004 14:30
Filling in DXF Cagnulein CorelDRAW CS 1 28-05-2004 14:49


All times are GMT -5. The time now is 19:59.


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