WordShape
OfficeIMO.Word
Represents simple shapes inside a paragraph.
Inheritance
- WordElement
- WordShape
Usage
Explore 17 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 17
- Method WordDocument.AddShape
- Method WordDocument.AddShapeDrawing
- Property WordDocument.Shapes
- Method WordHeader.AddShape
- Method WordHeader.AddShapeDrawing
- Method WordParagraph.AddShape
- Method WordParagraph.AddShapeDrawing
- Property WordParagraph.Shape
- Method WordSection.AddShape
- Method WordSection.AddShapeDrawing
- Property WordSection.Shapes
- Method WordShape.AddDrawingShape
- Method WordShape.AddDrawingShapeAnchored
- Method WordShape.AddEllipse
- Method WordShape.AddLine
- Method WordShape.AddPolygon
- Method WordShape.AddRoundedRectangle
Methods
public static WordShape AddDrawingShape(WordParagraph paragraph, WordShapeType shapeType, OfficeLength width, OfficeLength height) #Adds 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.
- width OfficeIMO.OfficeLength
- Shape width.
- height OfficeIMO.OfficeLength
- Shape height.
Returns
WordShapepublic static WordShape AddDrawingShapeAnchored(WordParagraph paragraph, WordShapeType shapeType, OfficeLength width, OfficeLength height, OfficeLength left, OfficeLength top) #Adds 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.
- width OfficeIMO.OfficeLength
- Shape width.
- height OfficeIMO.OfficeLength
- Shape height.
- left OfficeIMO.OfficeLength
- Left offset from the page.
- top OfficeIMO.OfficeLength
- Top offset from the page.
Returns
WordShapepublic static WordShape AddEllipse(WordParagraph paragraph, OfficeLength width, OfficeLength height, OfficeColor? fillColor = null) #Adds an ellipse shape to the given paragraph.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- width OfficeIMO.OfficeLength
- height OfficeIMO.OfficeLength
- fillColor OfficeIMO.OfficeColor? = null
Returns
WordShapepublic static WordShape AddLine(WordParagraph paragraph, OfficeLength startX, OfficeLength startY, OfficeLength endX, OfficeLength endY, OfficeColor? color = null, OfficeLength? strokeWeight = null) #Adds a line shape to the given paragraph.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- startX OfficeIMO.OfficeLength
- startY OfficeIMO.OfficeLength
- endX OfficeIMO.OfficeLength
- endY OfficeIMO.OfficeLength
- color OfficeIMO.OfficeColor? = null
- strokeWeight OfficeIMO.OfficeLength? = null
Returns
WordShapepublic static WordShape AddPolygon(WordParagraph paragraph, string points, string fillColor = "#FFFFFF", string strokeColor = "#000000") #Adds a polygon shape to the given paragraph.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- points string
- fillColor string = "#FFFFFF"
- strokeColor string = "#000000"
Returns
WordShapepublic static WordShape AddPolygon(WordParagraph paragraph, string points, OfficeColor fillColor, OfficeColor strokeColor) #Adds a polygon shape using OfficeColor values.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- points string
- fillColor OfficeIMO.OfficeColor
- strokeColor OfficeIMO.OfficeColor
Returns
WordShapepublic static WordShape AddRoundedRectangle(WordParagraph paragraph, OfficeLength width, OfficeLength height, OfficeColor? fillColor = null, double arcSize = 0.25) #Adds a rounded rectangle shape to the given paragraph.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- width OfficeIMO.OfficeLength
- height OfficeIMO.OfficeLength
- fillColor OfficeIMO.OfficeColor? = null
- arcSize double = 0.25
Returns
WordShapepublic bool TryGetLayoutSnapshot(out WordDrawingLayoutInfo snapshot) #Reads persisted inline or anchored package geometry for this DrawingML shape.
Parameters
- snapshot OfficeIMO.Word.WordDrawingLayoutInfo
- The package-geometry snapshot when this is a DrawingML shape with a supported frame.
Returns
bool true for DrawingML shapes with persisted frame geometry; VML-only shapes return false.Inherited Methods
Properties
public OfficeColor FillColor { get; set; } #Gets the resolved fill color. Setting a role retains DrawingML theme slots and resolves VML colors against the document.
public OfficeColor StrokeColor { get; set; } #Gets the resolved outline color. Setting a role retains DrawingML theme slots and resolves VML colors against the document.
public string? Description { get; set; } #Alternative text description of the shape.
public double? ArcSize { get; set; } #Corner roundness as a fraction between 0 and 1 for rounded rectangles.
public int? ZIndex { get; set; } #Gets or sets the z-index for VML shapes (style "z-index"). DrawingML is not affected.
public double? Rotation { get; set; } #Rotation of the shape in degrees. Returns null when not set.
public OfficeLength Width { get; set; } #Gets or sets the displayed shape width in VML or DrawingML. Returns zero when no width is stored.
public OfficeLength Height { get; set; } #Gets or sets the displayed shape height in VML or DrawingML. Returns zero when no height is stored.
public OfficeLength? Left { get; set; } #Gets or sets the horizontal shape offset. Inline DrawingML shapes return null and become anchored when an offset is set. Null clears the explicit offset.
public OfficeLength? Top { get; set; } #Gets or sets the vertical shape offset. Inline DrawingML shapes return null and become anchored when an offset is set. Null clears the explicit offset.
public OfficeLength? StrokeWeight { get; set; } #Gets or sets the outline thickness. Null removes the explicit thickness while preserving other outline formatting.