Compartir a través de


Stroke Class

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

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlCompositeElement
      DocumentFormat.OpenXml.Vml.Stroke

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

Syntax

'Declaration
<ChildElementInfoAttribute(GetType(ColumnStroke))> _
<ChildElementInfoAttribute(GetType(TopStroke))> _
<ChildElementInfoAttribute(GetType(LeftStroke))> _
<ChildElementInfoAttribute(GetType(BottomStroke))> _
<ChildElementInfoAttribute(GetType(RightStroke))> _
Public Class Stroke _
    Inherits OpenXmlCompositeElement
'Usage
Dim instance As Stroke
[ChildElementInfoAttribute(typeof(ColumnStroke))]
[ChildElementInfoAttribute(typeof(TopStroke))]
[ChildElementInfoAttribute(typeof(LeftStroke))]
[ChildElementInfoAttribute(typeof(BottomStroke))]
[ChildElementInfoAttribute(typeof(RightStroke))]
public class Stroke : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • DocumentFormat.OpenXml.Vml.Office.LeftStroke <o:left>

  • DocumentFormat.OpenXml.Vml.Office.TopStroke <o:top>

  • DocumentFormat.OpenXml.Vml.Office.RightStroke <o:right>

  • DocumentFormat.OpenXml.Vml.Office.BottomStroke <o:bottom>

  • DocumentFormat.OpenXml.Vml.Office.ColumnStroke <o:column>

[ISO/IEC 29500-1 1st Edition]

14.1.2.21 stroke (Line Stroke Settings)

This element describes how to draw the path if something beyond solid line with a solid color is desired.  The attributes of the stroke element can be used to describe a powerful set of stroke properties.   Extensions to the VML stroke definition are encoded as sub-elements of stroke.

[Example:

<v:polyline points="0pt,0pt,50pt,0pt,50pt,35pt,15pt,35pt,
  15pt,15pt,75pt,15pt">
  <v:stroke startarrow="classic" endarrow="classic" 
    startarrowwidth="wide" endarrowwidth="wide" dashstyle="dashdot" 
    weight="2pt" color="teal" linestyle="thinThin"/>
</v:polyline>

DocumentFormat.OpenXml.Vml.Stroke-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); shapedefaults (§14.2.2.28); shapetype (§14.1.2.20)

Child Elements

Subclause

bottom (Text Box Bottom Stroke)

§14.2.2.1

column (Text Box Interior Stroke)

§14.2.2.6

left (Text Box Left Stroke)

§14.2.2.16

right (Text Box Right Stroke)

§14.2.2.26

top (Text Box Top Stroke)

§14.2.2.32

Attributes

Description

althref (Alternate Image Reference)

Namespace: urn:schemas-microsoft-com:office:office

Specifies an alternate reference for an image in Macintosh PICT format.

[Example:

<v:stroke  althref="myimage.pcz"  >
</v:stroke>

end example]

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

color (Stroke Color)

Specifies the stroke color. Overrides the strokecolor attribute of a shape. Default is black. See the fillcolor attribute for a list of supported named colors.

[Example: The shape stroke is blue:

<v:shape  strokecolor="red"  >
  <v:stroke color="blue"/>
</v:shape>

end example]

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

color2 (Stroke Alternate Pattern Color)

Specifies a second color for strokes, used when filltype is pattern. Default is no value.

When a pattern fill is used for the stroke, the stroke color is used in colored parts of the source image. The color2 defines an alternate color to use in place of black in the source image.

[Example: This unusual example is intended to demonstrate how the image and colors interact to create a patterned stroke. The yellow background shows transparency. The non-square shape and square image create an effective offset. The heavy stroke weight shows more of the image. The green shape fill shows how the stroke is overlaid on the shape.

<v:background fillcolor="yellow"/>
<v:shape style="width:60;height:50"
  strokecolor="red" fillcolor="lime"
  path="m 0,0 l 0,1000 1000,1000 1000,0 x e">
  <v:stroke filltype="pattern" weight="10pt"
    src="myimage.gif" color2="blue"/>
</v:shape>
DocumentFormat.OpenXml.Vml.Stroke-image002

end example]

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

dashstyle (Stroke Dash Pattern)

Specifies the dot and dash pattern for a stroke. Default is solid. Pre-defined values are:

  • solid

  • shortdash

  • shortdot

  • shortdashdot

  • shortdashdotdot

  • dot

  • dash

  • longdash

  • dashdot

  • longdashdot

  • longdashdotdot

A custom-defined dash pattern can also be specified using a series of numbers. These define the length of the dash (the drawn part of the stroke) and the length of the space between the dashes. The lengths are relative to the line width: a length of 1 is equal to the line width. The endcap style is applied to each dash but the arrow style is not. The string defines the length of the dash then the length of the space. This can be repeated to form complex dash styles. The string should always contain a pair of numbers; if it contains an odd number of numbers the last is disregarded. 0 implies a dot that is fourfold symmetrical (with round end caps, this is a circle).

[Example:

<v:stroke dashstyle="0 2" weight="3pt"
  endcap="round">
</v:stroke>
DocumentFormat.OpenXml.Vml.Stroke-image003
<v:stroke dashstyle="longdashdotdot"
  weight="2pt">
</v:stroke>
DocumentFormat.OpenXml.Vml.Stroke-image004

end example]

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

endarrow (Line End Arrowhead)

Specifies an arrowhead for the end of a line. Default is none. The path shall not be closed with the x command for the arrowhead to show. Allowed values are:

  • none

  • block

  • classic

  • diamond

  • oval

  • open

[Example:

<v:stroke endarrow="classic"/>
DocumentFormat.OpenXml.Vml.Stroke-image005

end example]

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

endarrowlength (Line End Arrowhead Length)

Specifies the length of the arrowhead at the end of a line. Default is medium. Allowed values are:

  • short

  • medium

  • long

[Example:

<v:stroke  endarrowlength="long"  />
DocumentFormat.OpenXml.Vml.Stroke-image006

end example]

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

endarrowwidth (Line End Arrowhead Width)

Specifies the width of the arrowhead at the end of a line. Default is medium. Allowed values are:

  • narrow

  • medium

  • wide

[Example:

<v:stroke  endarrowwidth="wide"  />
DocumentFormat.OpenXml.Vml.Stroke-image007

end example]

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

endcap (Line End Cap)

Specifies the cap style for the end of a stroke. Default is flat. Allowed values are:

  • flat

  • square

  • round

[Example:

<v:stroke  endcap="round" weight="10pt"  />
DocumentFormat.OpenXml.Vml.Stroke-image008DocumentFormat.OpenXml.Vml.Stroke-image009DocumentFormat.OpenXml.Vml.Stroke-image010

end example]

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

filltype (Stroke Image Style)

Specifies the kind offill used for the background of a stroke. Default is solid. Allowed values are:

  • solid - The fill pattern is solid.

  • tile - The fill image is tiled.

  • pattern - The fill image is stretched to form a pattern.

  • frame - The fill image becomes a border for the shape.

[Example:

<v:shape style="width:50;height:50"
  strokecolor="red" 
  path="m 0,0 l 0,1000 1000,1000 1000,0 x e">
  <v:stroke filltype="frame" weight="10pt"
    src="border.gif"/>
</v:shape>
DocumentFormat.OpenXml.Vml.Stroke-image011

end example]

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

forcedash (Force Dashed Outline)

Namespace: urn:schemas-microsoft-com:office:office

Specifies whether a dashed outline is used to draw a shape when a shape has no line or fill. Default is false.

Used by PresentationML placeholders to draw a dashed outline when there is no line and no fill for a shape.

[Example:

<v:shape  o:forcedash="true"  >
</v:shape>

end example]

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

href (Original Image Reference)

Namespace: urn:schemas-microsoft-com:office:office

Specifies the URL to the original image file. Used only if the picture has been linked and embedded. Default is no value.

[Example:

<v:fill  o:href="myimage.gif"  >
</v:fill>

end example]

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

id (Relationship)

Namespace: .../officeDocument/2006/relationships

Specifies the relationship ID of the relationship to the image used for the stroke. The specified relationship shall be of type https://schemas.openxmlformats.org/officeDocument/2006/relationships/image or the document shall be considered non-conformant.

[Example: The markup specifies the associated relationship part with relationship ID rId10 contains the corresponding relationship information:

< … r:id="rId10" />

end example]

The possible values for this attribute are defined by the ST_RelationshipId simple type (Part 1, §22.8.2.1).

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.

imagealignshape (Stoke Image Alignment)

Specifies the alignment of the stroke image. If true, the image is aligned with the shape. Otherwise, it is aligned with the containing scope. Default is true.

[Example: The top position offset shifts the image alignment relative to the containing window:

<v:shape fillcolor="silver"
  style="top:20;width:50;height:50"
  path="m 0,0 l 0,1000 1000,1000 1000,0 x e">
  <v:stroke imagealignshape="false" weight="20pt"
    filltype="tile" src="myimage.gif"/>
</v:shape>
DocumentFormat.OpenXml.Vml.Stroke-image012DocumentFormat.OpenXml.Vml.Stroke-image013

end example]

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

imageaspect (Stroke Image Aspect Ratio)

Specifies how the stroke image aspect ratio is preserved. Default is ignore. Allowed values are:

Value

Description

ignore

Ignore aspect issues.

atleast

Image is at least as big as imagesize.

atmost

Image is no bigger than imagesize.

[Example:

<v:stroke filltype="frame" weight="10pt" 
  src="border.gif" imagealignshape="true" 
  imageaspect="atleast">
</v:stroke>
DocumentFormat.OpenXml.Vml.Stroke-image014DocumentFormat.OpenXml.Vml.Stroke-image015DocumentFormat.OpenXml.Vml.Stroke-image016

end example]

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

imagesize (Stroke Image Size)

Specifies the size of the image for the stroke. Default is the size of the image.

[Example:

<v:stroke  imagesize="10pt,10pt"  />

end example]

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

insetpen (Inset Border From Path)

Specifies that the border shall be displayed inside of the path defining the shape, rather than along the path (the default border placement), or outside of the path as might be done with an image.

[Example:

<v:shape  insetpen="true"  >
</v:shape>

end example]

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

joinstyle (Line End Join Style)

Specifies the join style for line ends. Default is round.

  • round

  • bevel

  • miter

[Example:

<v:polyline strokeweight="10pt" strokecolor="navy"
  points="10pt,10pt,50pt,50pt,90pt,10pt">
  <v:stroke joinstyle="bevel"/>
</v:polyline>
DocumentFormat.OpenXml.Vml.Stroke-image017DocumentFormat.OpenXml.Vml.Stroke-image018DocumentFormat.OpenXml.Vml.Stroke-image019

end example]

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

linestyle (Stroke Line Style)

Specifies the line style of the stroke. Default is single.

  • single

  • thinThin

  • thinThick

  • thickThin

  • thickBetweenThin

[Example:

<v:stroke linestyle="thickThin" weight="5pt">
</v:stroke>
DocumentFormat.OpenXml.Vml.Stroke-image020

end example]

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

miterlimit (Miter Joint Limit)

Specifies the smoothness of the miter joint, or the maximum distance between the inner point and outer point of a joint. This number is a multiple of the thickness of the line. Default is 8.

[Example:

<v:stroke joinstyle="miter" weight="10pt" 
  miterlimit="2">
</v:stroke>
DocumentFormat.OpenXml.Vml.Stroke-image021

end example]

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

on (Stroke Toggle)

Specifies whether the stroke is displayed. Default is true. This attribute overrides the shape's stroke attribute.

[Example:

<v:rect style="width:50;height:50" stroked="true" 
  fillcolor="lime" strokecolor="red">
  <v:stroke on="false" weight="5pt"/>
</v:rect> 
DocumentFormat.OpenXml.Vml.Stroke-image022

end example]

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

opacity (Stroke Opacity)

Specifies the amount of transparency of a stroke. Default is 1.0.

[Example:

<v:rect style="width:50;height:50" 
  fillcolor="lime" strokecolor="red">
  <v:stroke weight="5pt" opacity="50%"/>
</v:rect>
DocumentFormat.OpenXml.Vml.Stroke-image023

end example]

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

relid (Relationship to Part)

Namespace: urn:schemas-microsoft-com:office:office

Specifies the relationship ID of the relationship to the image. The specified relationship shall be of type https://schemas.openxmlformats.org/officeDocument/2006/relationships/image or the document shall be considered non-conformant.

[Example: The markup specifies the associated relationship part with relationship ID rId10 contains the corresponding relationship information:

<v:stroke  o:relid="rId10" >
</v:stroke>

end example]

The possible values for this attribute are defined by the ST_RelationshipId simple type (Part 1, §22.8.2.1).

src (Stroke Image Location)

Specifies the source image to load for a stroke fill. Default is no value.

[Example:

<v:stroke  src="myimage.gif"  >
</v:stroke>

end example]

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

startarrow (Line Start Arrowhead)

Specifies an arrowhead for the start of a line. Default is none. The path shall not be closed with the x command for the arrowhead to show. Allowed values are:

  • none

  • block

  • classic

  • diamond

  • oval

  • open

[Example:

<v:stroke startarrow="classic"/>
DocumentFormat.OpenXml.Vml.Stroke-image024

end example]

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

startarrowlength (Line Start Arrowhead Length)

Specifies the length of the arrowhead at the start of a line. Default is medium. Allowed values are:

  • short

  • medium

  • long

[Example:

<v:stroke  startarrowlength="long"  />
DocumentFormat.OpenXml.Vml.Stroke-image025

end example]

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

startarrowwidth (Line Start Arrowhead Width)

Specifies the width of the arrowhead at the start of a line. Default is medium. Allowed values are:

  • narrow

  • medium

  • wide

[Example:

<v:stroke  startarrowwidth="wide"  />
DocumentFormat.OpenXml.Vml.Stroke-image026

end example]

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

title (Stroke Title)

Namespace: urn:schemas-microsoft-com:office:office

Specifies the title of an embedded stroke image. This is typically set to the comment property of the image, which is often blank.

[Example:

<v:fill  o:title="alt text"  >
</v:fill>

end example]

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

weight (Stroke Weight)

Specifies the thickness of a stroke. Default is 1. This attribute overrides the shape's strokeweight attribute.

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

[Note: The W3C XML Schema definition of this element’s content model (CT_Stroke) 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

Stroke Members

DocumentFormat.OpenXml.Vml Namespace