API Reference
WordShape
Represents simple shapes inside a paragraph.
Inheritance
- WordElement
- WordShape
Constructors
WordShape(OfficeIMO.Word.WordDocument arg1, OfficeIMO.Word.WordParagraph arg2, System.Double arg3, System.Double arg4, System.String arg5) #Initializes a new rectangle shape and appends it to the paragraph.
Parameters
- arg1 OfficeIMO.Word.WordDocument
- arg2 OfficeIMO.Word.WordParagraph
- arg3 System.Double
- arg4 System.Double
- arg5 System.String
WordShape(OfficeIMO.Word.WordDocument arg1, DocumentFormat.OpenXml.Wordprocessing.Paragraph arg2, DocumentFormat.OpenXml.Wordprocessing.Run arg3, DocumentFormat.OpenXml.Wordprocessing.Drawing arg4) #Initializes a WordShape from existing run content.
Parameters
- arg1 OfficeIMO.Word.WordDocument
- arg2 DocumentFormat.OpenXml.Wordprocessing.Paragraph
- arg3 DocumentFormat.OpenXml.Wordprocessing.Run
- arg4 DocumentFormat.OpenXml.Wordprocessing.Drawing
Methods
public static WordShape AddDrawingShape(WordParagraph paragraph, ShapeType 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.ShapeType
- Type of shape to create.
- widthPt System.Double
- Width in points.
- heightPt System.Double
- Height in points.
public static WordShape AddDrawingShapeAnchored(WordParagraph paragraph, ShapeType 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 drawing anchor.
- shapeType OfficeIMO.Word.ShapeType
- 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, Color fillColor) #WordShapeAdds an ellipse shape to the given paragraph.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- widthPt System.Double
- heightPt System.Double
- fillColor System.String = "#FFFFFF"
AddEllipse(OfficeIMO.Word.WordParagraph paragraph, System.Double widthPt, System.Double heightPt, SixLabors.ImageSharp.Color fillColor) #Adds an ellipse shape using Color.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- widthPt System.Double
- heightPt System.Double
- fillColor SixLabors.ImageSharp.Color
public static WordShape AddLine(WordParagraph paragraph, Double startXPt, Double startYPt, Double endXPt, Double endYPt, Color color, 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
AddLine(OfficeIMO.Word.WordParagraph paragraph, System.Double startXPt, System.Double startYPt, System.Double endXPt, System.Double endYPt, SixLabors.ImageSharp.Color color, System.Double strokeWeightPt) #Adds a line shape using Color.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- startXPt System.Double
- startYPt System.Double
- endXPt System.Double
- endYPt System.Double
- color SixLabors.ImageSharp.Color
- strokeWeightPt System.Double
public static WordShape AddPolygon(WordParagraph paragraph, String points, Color fillColor, Color strokeColor) #WordShapeAdds a polygon shape to the given paragraph.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- points System.String
- fillColor System.String = "#FFFFFF"
- strokeColor System.String = "#000000"
AddPolygon(OfficeIMO.Word.WordParagraph paragraph, System.String points, SixLabors.ImageSharp.Color fillColor, SixLabors.ImageSharp.Color strokeColor) #Adds a polygon shape using Color values.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- points System.String
- fillColor SixLabors.ImageSharp.Color
- strokeColor SixLabors.ImageSharp.Color
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
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 Color FillColor { get; set; } #Gets or sets the fill color using Color.
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 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.
Fields
_document #Parent document.
_wordParagraph #Parent paragraph.
_run #Run that hosts the shape.
_rectangle #The rectangle element if present.
_roundRectangle #The rounded rectangle element if present.
_ellipse #The ellipse element if present.
_line #The line element if present.
_polygon #The polygon element if present.
_shape #The generic shape element if present.
_drawing #DrawingML shape element if present.