API Reference
WordShape
Represents simple shapes inside a paragraph.
Inheritance
- WordElement
- WordShape
Usage
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by
- Method WordDocument.AddShape
- Method WordDocument.AddShape
- Method WordDocument.AddShapeDrawing
- Method WordDocument.AddShapeDrawing
- Property WordDocument.Shapes
- Method WordHeader.AddShape
- Method WordHeader.AddShape
- Method WordHeader.AddShapeDrawing
- Method WordParagraph.AddShape
- Method WordParagraph.AddShape
- Method WordParagraph.AddShape
- Method WordParagraph.AddShape
- Method WordParagraph.AddShapeDrawing
- Method WordParagraph.AddShapeDrawing
- Property WordParagraph.Shape
- Method WordSection.AddShape
- Method WordSection.AddShape
- Method WordSection.AddShapeDrawing
- Property WordSection.Shapes
- Method WordShape.AddDrawingShape
- Method WordShape.AddDrawingShapeAnchored
- Method WordShape.AddEllipse
- Method WordShape.AddEllipse
- Method WordShape.AddLine
- Method WordShape.AddLine
- Method WordShape.AddPolygon
- Method WordShape.AddPolygon
- Method WordShape.AddRoundedRectangle
Methods
public static WordShape AddDrawingShape(WordParagraph paragraph, WordShapeType shapeType, Double widthPt, Double heightPt) #WordShapeAdds a DrawingML shape to the given paragraph.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- Paragraph to append the shape to.
- shapeType OfficeIMO.Word.WordShapeType
- Type of shape to create.
- widthPt System.Double
- Width in points.
- heightPt System.Double
- Height in points.
public static WordShape AddDrawingShapeAnchored(WordParagraph paragraph, WordShapeType shapeType, Double widthPt, Double heightPt, Double leftPt, Double topPt) #WordShapeAdds a DrawingML shape anchored at an absolute position on the page.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- Paragraph to host the WordDrawing anchor.
- shapeType OfficeIMO.Word.WordShapeType
- Type of shape.
- widthPt System.Double
- Width in points.
- heightPt System.Double
- Height in points.
- leftPt System.Double
- Left offset in points from the page.
- topPt System.Double
- Top offset in points from the page.
public static WordShape AddEllipse(WordParagraph paragraph, Double widthPt, Double heightPt, String fillColor = "#FFFFFF") #WordShapeAdds an ellipse shape to the given paragraph.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- widthPt System.Double
- heightPt System.Double
- fillColor System.String = "#FFFFFF"
public static WordShape AddEllipse(WordParagraph paragraph, Double widthPt, Double heightPt, OfficeColor fillColor) #WordShapeAdds an ellipse shape using OfficeColor.
Parameters
- arg1 OfficeIMO.Word.WordParagraph
- arg2 System.Double
- arg3 System.Double
- arg4 OfficeIMO.Drawing.OfficeColor
public static WordShape AddLine(WordParagraph paragraph, Double startXPt, Double startYPt, Double endXPt, Double endYPt, String color = "#000000", Double strokeWeightPt = 1) #WordShapeAdds a line shape to the given paragraph.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- startXPt System.Double
- startYPt System.Double
- endXPt System.Double
- endYPt System.Double
- color System.String = "#000000"
- strokeWeightPt System.Double = 1
public static WordShape AddLine(WordParagraph paragraph, Double startXPt, Double startYPt, Double endXPt, Double endYPt, OfficeColor color, Double strokeWeightPt = 1) #WordShapeAdds a line shape using OfficeColor.
Parameters
- arg1 OfficeIMO.Word.WordParagraph
- arg2 System.Double
- arg3 System.Double
- arg4 System.Double
- arg5 System.Double
- arg6 OfficeIMO.Drawing.OfficeColor
- arg7 System.Double = 1
public static WordShape AddPolygon(WordParagraph paragraph, String points, String fillColor = "#FFFFFF", String strokeColor = "#000000") #WordShapeAdds a polygon shape to the given paragraph.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- points System.String
- fillColor System.String = "#FFFFFF"
- strokeColor System.String = "#000000"
public static WordShape AddPolygon(WordParagraph paragraph, String points, OfficeColor fillColor, OfficeColor strokeColor) #WordShapeAdds a polygon shape using OfficeColor values.
Parameters
- arg1 OfficeIMO.Word.WordParagraph
- arg2 System.String
- arg3 OfficeIMO.Drawing.OfficeColor
- arg4 OfficeIMO.Drawing.OfficeColor
public static WordShape AddRoundedRectangle(WordParagraph paragraph, Double widthPt, Double heightPt, String fillColor = "#FFFFFF", Double arcSize = 0.25) #WordShapeAdds a rounded rectangle shape to the given paragraph.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- widthPt System.Double
- heightPt System.Double
- fillColor System.String = "#FFFFFF"
- arcSize System.Double = 0.25
public Boolean TryGetLayoutSnapshot(out WordDrawingLayoutSnapshot snapshot) #BooleanReads persisted inline or anchored package geometry for this DrawingML shape.
Parameters
- snapshot OfficeIMO.Word.WordDrawingLayoutSnapshot@
- The package-geometry snapshot when this is a DrawingML shape with a supported frame.
Returns
true for DrawingML shapes with persisted frame geometry; VML-only shapes return false.
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
Properties
public String FillColorHex { get; set; } #Gets or sets the fill color as hexadecimal string (no leading '#', lowercase).
public OfficeColor FillColor { get; set; } #Gets or sets the fill color using OfficeColor.
public String Description { get; set; } #Alternative text description of the shape.
public String StrokeColorHex { get; set; } #Outline color in hex format (no leading '#', lowercase). Null when not applicable.
public OfficeColor StrokeColor { get; set; } #Outline color using OfficeColor.
public Nullable<Double> StrokeWeight { get; set; } #Outline thickness in points.
public Nullable<Double> ArcSize { get; set; } #Corner roundness as a fraction between 0 and 1 for rounded rectangles.
public Nullable<Boolean> Stroked { get; set; } #Determines whether the outline is drawn.
public Nullable<Int32> ZIndex { get; set; } #Gets or sets the z-index for VML shapes (style "z-index"). DrawingML is not affected.
public Nullable<Double> Left { get; set; } #Left position of the shape in points. Returns null when not explicitly set.
public Nullable<Double> Top { get; set; } #Top position of the shape in points. Returns null when not explicitly set.
public Nullable<Double> Rotation { get; set; } #Rotation of the shape in degrees. Returns null when not set.