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 15-04-2013, 05:09
Joe Joe is offline
Member
 
Join Date: Nov 2008
Location: Latvia
Posts: 92
Send a message via Skype™ to Joe
Question Custom bullet macro and a question about text line types

Hello all, haven't been here for a while.

I have built a little something that might be useful to someone, but also have a technical question related to text lines.

Basically it's a custom bullet engine - you pick a text shape, then pick another shape and this shape gets distributed at the start of each line, here's an example:

Pick the text, start the macro, pick the custom bullet shape and get this:


Now my question is - is there a decent way to distinguish line types, whether they end "naturally" or by hand. The result would be "proper" bulleting, like this:


The text operations seem to be my Achilles' heel so the solution isn't too obvious.

Here's the code (pardon the terrible If...then blocks):

Code:
'TextLineRects part Courtesy of janga on CorelDRAW forums
Sub CustomBullets()

    If CheckDoc(True) Then
        Dim S As Shape
        Dim D As Shape
        Dim line As TextRange
        Dim X As Double
        Dim Y As Double

        Dim Good As Boolean

        Dim ShiftX As Double
        Dim ShiftY As Double

        ShiftX = -10
        ShiftY = 0

        Set S = ActiveSelection.Shapes.First

        If S.Type = cdrTextShape Then

            Good = ActiveDocument.GetUserClick(X, Y, 0, 10, False, cdrCursorEyeDrop)

            If Not Good Then
                Set D = ActivePage.SelectShapesAtPoint(X, Y, True).Shapes.Last

                If Not D Is Nothing Then

                    'boostStart "Custom Bullets"

                    ActiveDocument.Unit = cdrMillimeter

                    For Each line In S.text.Story.Lines
                        ' redimension the TextRange to recalculate the dimensions
                        line.SetRange line.Start, line.Start
                        X = line.TextLineRects.BoundingBox.Left
                        Y = line.TextLineRects.BoundingBox.CenterY

                        Set S = D.Duplicate
                        D.CenterX = X + ShiftX
                        D.CenterY = Y + ShiftY
                    Next

                    'boostFinish True

                End If

            End If

        End If

    End If

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
Developer for Custom Macro AnVa CorelDRAW/Corel DESIGNER VBA 3 22-03-2011 02:49
Removing a line written to a text file Keefster CorelDRAW/Corel DESIGNER VBA 1 28-03-2009 00:03
nudge line spacing on text with hotkeys Jeff Harrison CorelDRAW/Corel DESIGNER VBA 4 12-07-2007 21:00
change default bullet in Corel 9 jukos General 0 31-10-2006 12:41
I can't let the text on a curve line Dino CorelDRAW/Corel DESIGNER VBA 2 11-04-2003 05:13


All times are GMT -5. The time now is 07:01.


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