View Single Post
  #13   Report Post  
Posted to microsoft.public.word.docmanagement
Yves Dhondt Yves Dhondt is offline
external usenet poster
 
Posts: 767
Default Curved lines in Word?

Yes and no. It is possible, but not simply through the user interface as far
as I know.

The following macro (watch for linewraps!!!) inserts a curved text where you
can change the settings whatever way you want through the variables.
http://img14.imageshack.us/img14/579/curvedtext.png shows a screenshot of
the effect of changing the value of the fitPath variable as well as the
curve on which the text is displayed.

============== Begin Macro 1 ==============
Sub CurvedTextPOC()
' Variable which will hold the VML definition.
Dim xml As String
' Defines the Bezier curve.
' curve(1,.) = from
' curve(2,.) = control1
' curve(3,.) = control2
' curve(4,.) = to
Dim curve(1 To 4, 1 To 2) As Single
' The text to display.
Dim text As String
' The style of the text.
' CSS-2 definition of the text style.
Dim style As String
' Indicates if the text should fit the entire curve or not.
Dim fitPath As Boolean

' Set values for variables
curve(1, 1) = 50 ' from
curve(1, 2) = 100
curve(2, 1) = 200 ' control 1
curve(2, 2) = 200
curve(3, 1) = 300 ' control 2
curve(3, 2) = 200
curve(4, 1) = 400 ' to
curve(4, 2) = 100

text = "An example of curved text"

style = "font:normal normal normal 14pt Calibri"

fitPath = False


' Start the xml.
xml = "w:wordDocument xmlns:v='urn:schemas-microsoft-com:vml'
xmlns:w='http://schemas.microsoft.com/office/word/2003/wordml'w:bodyww:rwict"

' Curved text.
xml = xml & "v:curve from='" & curve(1, 1) & "," & curve(1, 2) & "' "
xml = xml & "control1='" & curve(2, 1) & "," & curve(2, 2) & "' "
xml = xml & "control2='" & curve(3, 1) & "," & curve(3, 2) & "' "
xml = xml & "to='" & curve(4, 1) & "," & curve(4, 2) & "'"

xml = xml & "vath textpathok='true' /"

xml = xml & "v:textpath on='true' style='" & style & "' string='" & text
& "' fitpath='" & fitPath & "' /"

xml = xml & "/v:curve"

' Finish the xml.
xml = xml & "/wict/w:r/w/w:body/w:wordDocument"

' Insert the result.
Selection.InsertXML (xml)

End Sub
============== End Macro 1 ==============

The following macro (watch linewrapping!!!) is just a piece of code to show
that Word can actually display text along any defined path. The result of
this macro can be seen at
http://img191.imageshack.us/img191/3426/curvedtext2.png

============== Begin Macro 2 ==============
Sub ComplexCurvedTextPOC()
Dim xml As String

xml = "w:wordDocument xmlns:v='urn:schemas-microsoft-com:vml'
xmlns:w='http://schemas.microsoft.com/office/word/2003/wordml'w:bodyww:rwictv:shape
path='m337,2045c168,1216,,388,337,425v337,37,1435, 1862,2025,1845c2952,2253,3412,283,3877,320v465,37, 833,2170,1275,2175c5594,2500,6090,382,6532,350v442 ,-32,868,1972,1275,1950c8214,2278,8667,430,8977,215, 9287,,9530,840,9667,1010e'
filled='false'vath textpathok='true'/v:textpath on='true'
style='font:normal normal normal 16pt Calibri' string='A complex curved text
in Word, it is possible if you know some VML.'
//v:shape/wict/w:r/w/w:body/w:wordDocument"

Selection.InsertXML (xml)

End Sub
============== End Macro 2 ==============

Yves

"Peter T. Daniels" wrote in message
...
I'd like to draw a path -- a simple arc -- and type along it (to make
labels on a map). Is this possible in Word?

When I try WordArt, and I increase the curve of the line of type, it
stretches the type rather than simply curving the line.

If it can be done in Publisher or PowerPoint, that would be fine too.