OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > Code Critique

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 30-12-2010, 11:33
shafor
Guest
 
Posts: n/a
Default ArtisticText Alignment

I would like to create ArtisticText and have it aligned in shape2 however no matter what I try it does not work. I am new to Corel but use scripting in my dayjob. Any help would be great! Below is the code that I currently have to create 2 shapes and create the text.


Code:
Set objCorelDraw = CreateObject("CorelDRAW.Application.15")
objCorelDraw.Visible = True
 
Set d = objCorelDraw.CreateDocument
 
With d.ActivePage
	.Orientation = cdrLandscape
	.SizeWidth = 3
	.SizeHeight = 3
	.PrintExportBackground = False
	.Background = cdrPageBackgroundNone
End With

Set shape1 = d.ActiveLayer.CreateRectangle2(0, 0, 3, 3, 0.3375, 0.3375, 0.3375, 0.3375) 
d.ActiveShape.Outline.Width = 0.003
d.ActiveShape.Outline.Color.RGBAssign 255, 0, 0

Set shape2 = d.ActiveLayer.CreateRectangle2(0, 0, 3, 3, 0.3375, 0.3375, 0.3375, 0.3375) 
d.ActiveShape.Outline.Width = 0.025
d.ActiveShape.Outline.Color.RGBAssign 0, 255, 0

Set txt = d.ActiveLayer.CreateArtisticText(0, 0, "Hello World", , , "Arial Black", 24)
Set txt = shape2.PlaceTextInside(txt)
Reply With Quote
  #2  
Old 30-12-2010, 12:43
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,770
Blog Entries: 10
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 AlignToShape

Instead of placing the text inside the shape, just align to text to shape2 like this:
Code:
txt.AlignToShape cdrAlignHCenter + cdrAlignVCenter, shape2
-Shelby
Reply With Quote
  #3  
Old 30-12-2010, 15:27
shafor
Guest
 
Posts: n/a
Default

Thanks for your reply. I just tried it and the text is located at 0,0 and is set to the left. The only item that may be different than most is that I am running this script as .VBS script from my desktop. I am attaching a screenshot of the results.
Attached Images
 
Reply With Quote
  #4  
Old 30-12-2010, 17:31
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
I tested this earlier with Shelby's add and it worked great. The only modification to it was declaring the variables shape1, shape2, and txt as shapes.

-John
Reply With Quote
  #5  
Old 31-12-2010, 06:08
shafor
Guest
 
Posts: n/a
Default

Thanks for your review. I think the problem is that .VBS script cannot declared as a shape. I have seen other threads on this but not a clear cut solution. If you have any suggestions, I'm all ears. Again, thanks for your guys help.
Reply With Quote
  #6  
Old 31-12-2010, 10:19
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,770
Blog Entries: 10
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 VBS Script

Is there a reason you have to us VBS Script? I know it does work in VBA, so maybe that might work for you.

-Shelby
Reply With Quote
  #7  
Old 31-12-2010, 12:28
shafor
Guest
 
Posts: n/a
Default

I could try it - Worse case is I convert it over to a small VB.NET application. I really appreciate all of your help in this. I will try it out this weekend and will let you know.
Reply With Quote
  #8  
Old 05-01-2011, 12:52
shafor
Guest
 
Posts: n/a
Default

Thanks for all of your help - I was able to resolve the issue and have the file run from the desktop as a vbs. The issue was that .VBS did not know how to handle the line cdrAlignVCenter or cdrAlignHCenter. I changed these to their values and it worked like a champ. I found these values at: http://www.grafxdosgueros.com/vba/dr...AlignType.html.

The updated code is below:
VBA
Code:
 txt.AlignToShape cdrAlignHCenter + cdrAlignVCenter, shape1
VBS
Code:
 txt.AlignToShape 3 + 12, shape1
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
How to select the same ArtisticText engandy CorelDRAW/Corel DESIGNER VBA 5 08-10-2008 02:59
scaling objects and alignment eldwin CorelDRAW/Corel DESIGNER VBA 4 01-03-2008 09:53
How do I reference ArtisticText objects? "Shape Index o andyb CorelDRAW/Corel DESIGNER VBA 1 10-07-2003 14:59
how can i get coreldraw artistic text alignment batman| CorelDRAW/Corel DESIGNER VBA 6 17-01-2003 04:43
artistic text alignment batman| CorelDRAW CS 0 04-01-2003 04:39


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


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