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 23-10-2003, 04:41
jwknight
Guest
 
Posts: n/a
Default Converting objects color properties

Hi all,
I would like to be able to select all the objects in a document and convert their properties to CMYK at the same time. I have tried with the text below but it isn't working. I'm fairly certain that its possible and very easy to do. Could anybody please help a useless programmer.

Many Thanks

Also while i'm asking. I would like to select all objects of a certain color. I know it can be done because there is a find object wizard. I'm guessing that there is some code that can replicate this.

CorelDRAW.CorelScript.SelectAllObjects
Set q = CorelDRAW.ActiveSelection
q.Outline.Color.ConvertToCMYK
Reply With Quote
  #2  
Old 23-10-2003, 10:03
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,941
Blog Entries: 4
Default Re: Converting objects color properties

It is not as easy as it may sound. There is no one-shot command which would find objects by their fill or outline colors but you can do it fairly easily yourself. You can take a look at Oberon Color Replacer which does exactly that - going through all objects and replacing one color with another.

Here is a simplified version of the code using in the Color Replacer macro which goes through all objects and converts fill and outline colors to CMYK:

Code:
Public Sub ConvertAllColorsToCMYK()
    ConvertShapes ActivePage.Shapes
End Sub

Private Sub ConvertShapes(ss As Shapes)
    Dim s As Shape
    
    For Each s In ss
        Select Case s.Type
            Case cdrTextShape, cdrRectangleShape, cdrPolygonShape, _
                 cdrLinearDimensionShape, cdrEllipseShape, cdrCurveShape, _
                 cdrConnectorShape, cdrBitmapShape
                 
                ConvertShapeColors s
                
            Case cdrGroupShape
                ConvertShapes s.Shapes
        End Select
        On Error Resume Next
        If Not s.PowerClip Is Nothing Then
            ConvertShapes s.PowerClip.Shapes
        End If
    Next s
End Sub

Private Sub ConvertShapeColors(s As Shape)
    Dim c As FountainColor
    ' 1. Convert Fill colors
    Select Case s.Fill.Type
        Case cdrUniformFill
            ConvertColor s.Fill.UniformColor
            
        Case cdrPatternFill
            ConvertColor s.Fill.Pattern.FrontColor
            ConvertColor s.Fill.Pattern.BackColor
            
        Case cdrFountainFill
            ConvertColor s.Fill.Fountain.StartColor
            ConvertColor s.Fill.Fountain.EndColor
            For Each c In s.Fill.Fountain.Colors
                ConvertColor c.Color
            Next c
    End Select
    
    ' 2. Convert outline color
    If s.Outline.Type = cdrOutline Then
        ConvertColor s.Outline.Color
    End If
End Sub

Private Sub ConvertColor(c As Color)
    c.ConvertToCMYK
End Sub
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
fit objects to path edges geopig Other Oberon Commercial Products 1 02-08-2006 23:28
Find objects by properties Webster CorelDRAW/Corel DESIGNER VBA 8 01-12-2004 18:51
Need help accessing objects in a group ama CorelDRAW/Corel DESIGNER VBA 5 20-02-2004 11:28
replace objects of certain color jwknight CorelDRAW/Corel DESIGNER VBA 3 14-08-2003 12:43
I need to update objects visibility faster NEHovis Corel Photo-Paint VBA 0 18-07-2003 07:54


All times are GMT -5. The time now is 05:24.


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