Share via


TextPath Class

Defines the TextPath Class.When the object is serialized out as xml, its qualified name is v:textpath.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlLeafElement
      DocumentFormat.OpenXml.Vml.TextPath

Namespace:  DocumentFormat.OpenXml.Vml
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

Syntax

'Declaration
Public Class TextPath _
    Inherits OpenXmlLeafElement
'Usage
Dim instance As TextPath
public class TextPath : OpenXmlLeafElement

Remarks

[ISO/IEC 29500-1 1st Edition]

14.1.2.23 textpath (Text Layout Path)

This element is used to define a vector path based on the text data, font and font styles supplied.  The path which results is then mapped into the region defined by the v attribute of the shape's path (§14.1.2.14).

[Example:

<v:curve from="50,100" to="400,100" 
  control1="200,200" control2="300,200">
  <v:stroke color="blue"/>
  <v:fill color="yellow" color2="green" type="gradient"/>
  <v:path textpathok="true"/>
  <v:textpath on="true" style="font:normal normal normal 36pt Arial"
    fitpath="true" string="Hello, VML!"/>
</v:curve>

DocumentFormat.OpenXml.Vml.TextPath-image001

end example]

Parent Elements

arc (§14.1.2.1); background (Part 1, §17.2.1); curve (§14.1.2.3); group (§14.1.2.7); image (§14.1.2.10); line (§14.1.2.12); object (Part 1, §17.3.3.19); oval (§14.1.2.13); pict (§9.2.2.2); pict (§9.5.1); polyline (§14.1.2.15); rect (§14.1.2.16); roundrect (§14.1.2.17); shape (§14.1.2.19); shapetype (§14.1.2.20)

Attributes

Description

fitpath (Path Fit Toggle)

Specifies whether the text fits the path of a shape. If true, sizes the text to fill the path it lies out on. Default is false.

[Example:

<v:textpath on="true" fitpath="true" 
  string="VML">
</v:textpath>
DocumentFormat.OpenXml.Vml.TextPath-image002
fitpath="true"
DocumentFormat.OpenXml.Vml.TextPath-image003
fitpath="false"

end example]

The possible values for this attribute are defined by the ST_TrueFalse simple type (§15.1.2.5).

fitshape (Shape Fit Toggle)

Specifies whether the text fits the bounding box of a shape. If true, the text is stretched out to the edges of the box that defines the entire shape. Default is false.

[Example: When fitshape is false, the text is drawn along the first part of the path. When true, the text is stretched to fit the entire enclosed area of the shape.

<v:shape style="width:100;height:100" 
  path="m 0,500 c 250,0 750,0 1000,500 e 
  m 0,600 c 250,900 750,900 1000,600 e" 
  fillcolor="yellow" strokecolor="maroon">
  <v:path textpathok="t"/>
  <v:textpath on="t" fitshape="t" string="VML"/>
</v:shape>
DocumentFormat.OpenXml.Vml.TextPath-image004

The raw path stroke is:

DocumentFormat.OpenXml.Vml.TextPath-image005

end example]

The possible values for this attribute are defined by the ST_TrueFalse simple type (§15.1.2.5).

id (Unique Identifier)

Specifies a unique identifier that can be used to reference a VML object.

Default is no value.

[Example:

<v:shape … id="myShape" … >
</v:shape>

end example]

The possible values for this attribute are defined by the W3C XML Schema string datatype.

on (Text Path Toggle)

Specifies whether the text is displayed on the textpath. Default is false. The textpathok attribute of the path element (§14.1.2.14) overrides this.

[Example:

<v:line from="50,100" to="100,100">
  <v:path textpathok="false"/>
  <v:textpath on="true" string="VML"/>
</v:line>  
DocumentFormat.OpenXml.Vml.TextPath-image006

end example]

The possible values for this attribute are defined by the ST_TrueFalse simple type (§15.1.2.5).

string (Text Path Text)

Specifies the text of the text path. Default is no value.

The possible values for this attribute are defined by the W3C XML Schema string datatype.

style (Shape Styling Properties)

Specifies the CSS2 styling properties of the shape. The CSS2 (Cascading Style Sheets, Level 2) specification, a Recommendation of the World Wide Web Consortium, is available here: http://www.w3.org/TR/REC-CSS2.

This attribute uses a semi-colon delimited list of “name:value” pairs, the syntax defined by section 4.1.8 of the CSS2 specification for grouped declarations (without the surrounding braces). The following tables define the allowed properties and the VML treatment of each.

[Example:

<v:shape … style=’position:absolute;width:100pt;height:50pt’ … >
</v:shape>

end example]

Property

Description

flip

Specifies that the orientation of a shape is flipped. Default is no value. Allowed values are:

  • x - Flip along the y-axis, reversing the x-coordinates.

  • y - Flip along the x-axis, reversing the y-coordinates.

  • xy - Flip along both the y- and x-axis.

  • yx - Flip along both the x- and y-axis.

height

Specifies the height of the containing block of the shape.  Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element. Allowed values are:

  • auto - Default position of an element in the flow of the page.

  • <units>- A number with an absolute units designator (cm, mm, in, pt, pc, or px) or a relative units designator (em or ex). If no units are given, pixels (px) is assumed.

  • <percentage>- Value expressed as a percentage of the parent object's height.

left

Specifies the position of the left of the containing block of the shape relative to the element left of it in the flow of the page. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element. This property shall not be used for shapes anchored inline. Allowed values are:

  • auto - Default position of an element in the flow of the page.

  • <units> - A number with an absolute units designator (cm, mm, in, pt, pc, or px) or a relative units designator (em or ex). If no units are given, pixels (px) is assumed.

  • <percentage>- Value expressed as a percentage of the parent object's width.

margin-bottom

Specifies the position of the bottom of the containing block of the shape relative to the shape anchor. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element. Allowed values are:

  • auto - Default position of an element in the flow of the page.

  • <units>- A number with an absolute units designator (cm, mm, in, pt, pc, or px) or a relative units designator (em or ex). If no units are given, pixels (px) is assumed.

  • <percentage>- Value expressed as a percentage of the parent object's height.

margin-left

Specifies the position of the left of the containing block of the shape relative to the shape anchor. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element. Allowed values are:

  • auto - Default position of an element in the flow of the page.

  • <units>- A number with an absolute units designator (cm, mm, in, pt, pc, or px) or a relative units designator (em or ex). If no units are given, pixels (px) is assumed.

  • <percentage>- Value expressed as a percentage of the parent object's width.

margin-right

Specifies the position of the right of the containing block of the shape relative to the shape anchor. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element. Allowed values are:

  • auto - Default position of an element in the flow of the page.

  • <units> - A number with an absolute units designator (cm, mm, in, pt, pc, or px) or a relative units designator (em or ex). If no units are given, pixels (px) is assumed.

  • <percentage>- Value expressed as a percentage of the parent object's width.

margin-top

Specifies the position of the top of the containing block of the shape relative to the shape anchor. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element. Allowed values are:

  • auto - Default position of an element in the flow of the page.

  • <units>- A number with an absolute units designator (cm, mm, in, pt, pc, or px) or a relative units designator (em or ex). If no units are given, pixels (px) is assumed.

  • <percentage>- Value expressed as a percentage of the parent object's height.

mso-position-horizontal

Specifies the horizontal positioning data for objects in WordprocessingML documents. Default is absolute. Allowed values are:

  • absolute

  • left

  • center

  • right

  • inside

  • outside

mso-position-horizontal-relative

Specifies relative horizontal position data for objects in WordprocessingML documents. This modifies the mso-position-horizontal property. Default is text. Allowed values are:

  • margin

  • page

  • text

  • char

mso-position-vertical

Specifies the vertical positioning data for objects in WordprocessingML documents. Default is absolute. Allowed values are:

  • absolute

  • top

  • center

  • bottom

  • inside

  • outside

mso-position-vertical-relative

Specifies relative vertical position data for objects in WordprocessingML documents. This modifies the mso-position-vertical property. Default is text. Allowed values are:

  • margin

  • page

  • text

  • line

mso-wrap-distance-bottom

Specifies the distance from the bottom of the shape to the text that wraps around it. Default is 0 pt. This property is different from the CSS margin property, which changes the origin of the shape to include the margin areas. This property does not change the origin.

mso-wrap-distance-left

Specifies the distance from the left side of the shape to the text that wraps around it. Default is 0 pt. This property is different from the CSS margin property, which changes the origin of the shape to include the margin areas. This property does not change the origin.

mso-wrap-distance-right

Specifies the distance from the right side of the shape to the text that wraps around it. Default is 0 pt. This property is different from the CSS margin property, which changes the origin of the shape to include the margin areas. This property does not change the origin.

mso-wrap-distance-top

Specifies the distance from the top of the shape to the text that wraps around it. Default is 0 pt. This property is different from the CSS margin property, which changes the origin of the shape to include the margin areas. This property does not change the origin.

mso-wrap-edited

Specifies whether the wrap coordinates were customized by the user. If the wrap coordinates are generated by an editor, this property is true; otherwise they were customized by a user. Default is false.

mso-wrap-style

Specifies the wrapping mode for text in shapes in WordprocessingML documents. Default is square. Allowed values are:

  • square - Wraps text inside the shape in a square.

  • none - Text does not wrap.

position

Specifies the kind of positioning used to place an element. Default is static. When the element is contained inside a group, this property shall be absolute. Allowed values are:

  • static - The element is positioned according to the normal flow of the page. The top and left properties are ignored. If the object is anchored inline, this value is used.

  • absolute - The element is positioned relative to the parent, using the top and left properties.

  • relative - The element is positioned according to the normal flow of the page, but the top and left properties are used. The overlap of overlapping elements is governed by the z-index property.

rotation

Specifies the angle that a shape is rotated, in degrees. Default is 0. Positive angles are clockwise.

top

Specifies the position of the top of the containing block of the shape relative to the element above it in the flow of the page. Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element. This property shall not be used for shapes anchored inline. Allowed values are:

  • auto - Default position of an element in the flow of the page.

  • <units>- A number with an absolute units designator (cm, mm, in, pt, pc, or px) or a relative units designator (em or ex). If no units are given, pixels (px) is assumed.

  • <percentage>- Value expressed as a percentage of the parent object's height.

visibility

Specifies whether a shape is displayed. Only inherit and hidden are used; any other values are mapped to inherit. Default is inherit. Allowed values are:

  • hidden - The shape is not visible, but is still part of the flow of the objects in the browser. Mouse events are not processed.

  • inherit - The visibility state is inherited from the parent of the shape.

width

Specifies the width of the containing block of the shape.  Default is 0. It is specified in CSS units or, for elements in a group, in the coordinate system of the parent element. Allowed values are:

  • auto - Default position of an element in the flow of the page.

  • <units>- A number with an absolute units designator (cm, mm, in, pt, pc, or px) or a relative units designator (em or ex). If no units are given, pixels (px) is assumed.

  • <percentage>- Value expressed as a percentage of the parent object's width.

z-index

Specifies the display order of overlapping shapes. Default is 0. This property shall not be used for shapes anchored inline. Allowed values are:

  • auto - Uses the order that the shapes appear in the page, bottom to top.

  • <order>- A number that represents the stacking precedence. Shapes with higher numbers are placed on top of those with lower numbers. Negative numbers are allowed.

The following properties are only used by the textbox element (§14.1.2.22):

Property

Description

direction

Specifies the direction of the text in the textbox. Default is ltr. This property is superceded by the mso-direction-alt property if that is specified. Allowed values are:

  • ltr - Text is displayed left-to-right.

  • rtl - Text is displayed right-to-left.

layout-flow

Determines the flow of the text layout in a textbox. Default is horizontal. Allowed values are:

  • horizontal - Text is displayed horizontally.

  • vertical - Text is displayed vertically.

  • vertical-ideographic - Ideographic text is displayed vertically.

  • horizontal-ideographic - Ideographic text is displayed horizontally.

mso-direction-alt

Specifies an alternate direction for text in textboxes. Overrides the direction property. The only allowed value is context.

mso-fit-shape-to-text

Specifies whether the shape stretches to fit the text in the textbox. Default is false.

mso-fit-text-to-shape

Specifies whether the text stretches to fit the textbox. Default is false.

mso-layout-flow-alt

Specifies the alternate layout flow for text in textboxes. This property is used instead of layout-flow when the layout flow is from bottom to top for non-ideographic languages.  Its only value is bottom-to-top.

mso-next-textbox

Specifies the ID of the next textbox in a series. Used to keep track of a set of linked textboxes. Default is no value.

mso-rotate

Specifies a specific rotation value for text in a textbox. Default is 0. Allowed values are:

  • 0

  • 90

  • 180

  • -90

mso-text-scale

Specifies the scaling factor for fitting text to shapes. Default is 0. This property is only used if mso-fit-text-to-shape is true.

v-text-anchor

Specifies the vertical anchoring of text in a textbox. Default is top. The alignment of a text anchor only becomes evident if mso-fit-text-to-shape is false. This property is different from the vertical-align CSS property, which is used for ideographic languages. Allowed values are:

  • top

  • middle

  • bottom

  • top-center

  • middle-center

  • bottom-center

  • top-baseline

  • bottom-baseline

  • top-center-baseline

  • bottom-center-baseline

The following properties are only used by the textpath element (§14.1.2.23):

Property

Description

font

Specifies a compound value of font settings. Default is no value. The values are the same as those of the CSS font property. The order of definitions in the string is: font-style, font-variant, font-weight, font-size, line-height, font-family.

font-family

Specifies the family of the font. Default is no value. The values are the same as those of the CSS font-family property.

font-size

Specifies the size of the font. Default is no value. The font size is defined in points. The values are the same as those of the CSS font-size property.

font-style

Specifies the amount of slant for a font. Default is normal. The values are the same as those of the CSS font-style property. Allowed values are:

  • normal

  • italic

  • oblique - Treated the same as italic.

font-variant

Specifies the variant style of a font. Default is normal. The values are the same as those of the CSS font-variant property. Allowed values are:

  • normal

  • small-caps

font-weight

Specifies the thickness of the letters of the font. Default is normal. The values are the same as those of the CSS font-weight property. Allowed values are:

Value

Description

normal

lighter

100

200

300

400

Treated as non-bold.

bold

bolder

500

600

700

800

900

Treated as bold.

mso-text-shadow

Specifies whether a shadow is applied to the text on a text path. Default is false.

text-decoration

Specifies the style of text decoration. Default is none. The values are the same as those of the CSS text-decoration property. Allowed values are:

  • none

  • underline

  • overline

  • line-through

  • blink

v-rotate-letters

Specifies whether the letters of the text are rotated counterclockwise by 90 degrees. Default is false.

v-same-letter-heights

Specifies whether all letters are the same height regardless of initial case. If true, the lowercase letters are stretched to the height of the uppercase letters. Default is false.

v-text-align

Specifies the alignment of text. Default is left. Allowed values are:

  • left

  • right

  • center

  • justify

  • letter-justify - Distributes the extra space between the letters.

  • stretch-justify - Stretches the letters to fill in the space.

v-text-kern

Specifies whether kerning is turned on. Default is false.

v-text-reverse

Specifies whether the layout order of rows is reversed. Default is false. This is used for vertical text layout.

v-text-spacing-mode

Specifies the mode for letter spacing. Default is tightening. This property determines whether space is removed between each letter (tightening) or added between each letter (tracking). The amount of letter spacing change is defined by the v-text-spacing property. Allowed values are:

  • tightening

  • tracking

v-text-spacing

Specifies the amount of spacing for text in 100ths of single line spacing. Default is 100.

The line (§14.1.2.12), polyline (§14.1.2.15) and curve (§14.1.2.3) elements ignore the following properties:

  • top

  • left

  • width

  • height

The following properties are not inherited by an element that references a shapetype element (§14.1.2.20) via the id attribute:

  • flip

  • height

  • left

  • margin-left

  • margin-top

  • position

  • rotation

  • top

  • visibility

  • width

  • z-index

The possible values for this attribute are defined by the W3C XML Schema string datatype.

trim (Text Path Trim Toggle)

Specifies whether extra space is removed above and below the text. If true, space reserved for ascenders and descenders is removed. Default is false.

[Example: The shape path is duplicated as a second shape and overlaid on the textpath for illustrative purposes:

<v:shape style=" width:100;height:100" 
  path="m 0,500 c 250,0 750,0 1000,500 e 
  m 0,600 c 250,900 750,900 1000,600 e" 
  fillcolor="yellow" strokecolor="maroon">
  <v:path textpathok="true"/>
  <v:textpath on="true" fitshape="true" 
    string="vml" trim="true"/>
</v:shape>   
DocumentFormat.OpenXml.Vml.TextPath-image007DocumentFormat.OpenXml.Vml.TextPath-image008

end example]

The possible values for this attribute are defined by the ST_TrueFalse simple type (§15.1.2.5).

xscale (Text X-Scaling)

Specifies whether a straight text path is used instead of the shape path. If true, the text runs along a path from left to right along the x value of the lower boundary of the shape. Default is false.

The possible values for this attribute are defined by the ST_TrueFalse simple type (§15.1.2.5).

[Note: The W3C XML Schema definition of this element’s content model (CT_TextPath) is located in §A.6.1. end note]

© ISO/IEC29500: 2008.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

TextPath Members

DocumentFormat.OpenXml.Vml Namespace