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 10-08-2010, 19:43
Mal
Guest
 
Posts: n/a
Default Changing text color. Vb.net & X5

I apologize if I'm posting this is the wrong section. Delete or move as necessary.

I am using a vb.net (VS2008) application to automate X5. I am just laying text on a page. The short of it is I load Dataary with multiple lines of text, use hpos/vpos as coordinates on the page and set the font and leading for the text.

All this works just fine.

I'm having trouble figuring out the syntax to set the text as any color. I can convert the works to curves and do it that way or just do the text as text. I've tried a number of different ways but I get syntax errors or object issues, etc.

Any suggestions would be welcome.

Thanks,
-Mal

Code:
    	corelobj = CreateObject("Coreldraw.Automation.15")


		Dim x As integer

		With corelobj
			.FileNew()
			.SetPageSize(4572000, 3048000)  '.SetPageSize(4572000, 3048000)
			I = 1
			zz = 1
			For x = 1 To pieceloop 
				For z = 1 To CInt(linestr) 
                            
					.CreateArtisticText(dataary(I), hposary(x), vposary(x) - Val(leadingv * (zz - 1)))
					.SetCharacterAttributes(0, Len(dataary(I)), font, fstyle, fontv * 10, 0, 0, 0, 0, cSpacing, 0, 0, 2)
					.SetParagraphSpacing(0, Len(dataary(I)), PrcSpacing, wSpacing, lSpacing, 0, 0, 2, 0, 0)
                           		zz += 1
                        		I += 1

				Next z
                		zz = 1

                		System.Windows.Forms.Application.DoEvents()
			Next x
			        .SelectAllObjects
                		.converttocurves
			''''Set color of objects here after converted?  Or do it up further where I'm laying out the text while it's still text.
		End With
	corelobj = Nothing
Reply With Quote
  #2  
Old 10-08-2010, 20:44
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,782
Blog Entries: 11
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Set Color

There are several ways to do this. First, you are using CorelSCRIPT calls, I would suggest not using CorelSCRIPT. :-)

Now, a couple ways to fill the text. You can create the text as a shape. Personally I like this method because you can always refer to the shape easily. Like this:
Code:
Sub MakeSameText()
    Dim s As Shape
    
    Set s = ActiveLayer.CreateArtisticText(0, 0, "Test", cdrEnglishUS, , "Arial", 24, , , , cdrLeftAlignment)
    s.Fill.ApplyUniformFill CreateCMYKColor(0, 100, 100, 0)
    s.Outline.SetProperties 0.001, , CreateCMYKColor(0, 100, 100, 0)
End Sub
or if you just wanted you can simple create the text like this:
Code:
Sub MakeSameText()
    With ActiveLayer.CreateArtisticText(0, 0, "Test", cdrEnglishUS, , "Arial", 24, , , , cdrLeftAlignment)
        .Fill.ApplyUniformFill CreateCMYKColor(0, 100, 100, 0)
        .Outline.SetProperties 0.001, , CreateCMYKColor(0, 100, 100, 0)
    End With
End Sub
Again the reason I like to create the text as a shape is that I can easily reference it. So if I want to now convert the text to curves I could do this.
Code:
s.ConvertToCurves
Hope that helps,

-Shelby
Reply With Quote
  #3  
Old 10-08-2010, 21:48
Mal
Guest
 
Posts: n/a
Default

Quote:
First, you are using CorelSCRIPT calls, I would suggest not using CorelSCRIPT. :-)
Thanks for your response.

I inherited an old vb app that was inherited from an old corelscript so that's no surprise. It works. Shrug.

I'll give what you posted a try in the morning. I tried something very similar but vb.net was barfing on it.

Thanks,
-Mal
Reply With Quote
  #4  
Old 10-08-2010, 23:21
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,782
Blog Entries: 11
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default CorelSCRIPT

If you have to go the CorelSCRIPT route you could try: (Doing this from memory so I could be way off)
Code:
.SelectAllObjects
.converttocurves
.StoreColor 2, 0, 100, 100, 0
.ApplyUniformFillColor
-Shelby
Reply With Quote
  #5  
Old 11-08-2010, 08:10
Mal
Guest
 
Posts: n/a
Default

Thank you.

That's all I needed. Works fine.

Code:
.storecolor(5, gRed, gGreen, gBlue)  '5 = RGB color model
.ApplyUniformFillcolor
As to the larger question...is the Corelscriptclass calls inherently slower or something? IN the vb.net object browser I see all different ways to do it but no clue as to which way is the most efficient or how the objects need to be called properly. (see below)

Thanks again.

-Mal
Reply With Quote
  #6  
Old 18-08-2010, 15:32
SteveDude SteveDude is offline
Senior Member
 
Join Date: Dec 2005
Location: Salina, Kansas USA
Posts: 149
Default

Stay away from the CorelScript stuff. It breaks things badly...on the other hand, if a VBA command is broke sometimes the CorelScript equivelent is the only way to go. VBA first, CorelScript as a last resort and yes CorelScript is much slower.
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
Changing color in artistic text zyptse CorelDRAW/Corel DESIGNER VBA 5 08-02-2008 15:04
Changing Selected text knowbodynow CorelDRAW/Corel DESIGNER VBA 2 17-10-2007 08:49
Changing text size in CD12 knowbodynow CorelDRAW/Corel DESIGNER VBA 10 07-03-2006 07:13
Changing The Color and The Outline Width At The Same Time katrina63 New product ideas 1 22-06-2005 19:19
Changing color space in an RGB only world... ddonnahoe CorelDRAW/Corel DESIGNER VBA 1 16-03-2005 14:44


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


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