Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

WordShape

OfficeIMO.Word

Namespace
OfficeIMO.Word
Assembly
OfficeIMO.Word
Source revision
0eef6a5756b9 with working tree changes

Represents simple shapes inside a paragraph.

Inheritance

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.

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 required
Paragraph to append the shape to.
shapeType OfficeIMO.Word.WordShapeType required
Type of shape to create.
width OfficeIMO.OfficeLength required
Shape width.
height OfficeIMO.OfficeLength required
Shape height.

Returns

WordShape
public 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 required
Paragraph to host the WordDrawing anchor.
shapeType OfficeIMO.Word.WordShapeType required
Type of shape.
width OfficeIMO.OfficeLength required
Shape width.
height OfficeIMO.OfficeLength required
Shape height.
left OfficeIMO.OfficeLength required
Left offset from the page.
top OfficeIMO.OfficeLength required
Top offset from the page.

Returns

WordShape
public 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 required
width OfficeIMO.OfficeLength required
height OfficeIMO.OfficeLength required
fillColor OfficeIMO.OfficeColor? = null optional

Returns

WordShape
public 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 required
startX OfficeIMO.OfficeLength required
startY OfficeIMO.OfficeLength required
endX OfficeIMO.OfficeLength required
endY OfficeIMO.OfficeLength required
color OfficeIMO.OfficeColor? = null optional
strokeWeight OfficeIMO.OfficeLength? = null optional

Returns

WordShape
AddPolygon 2 overloads
public 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 required
points string required
fillColor string = "#FFFFFF" optional
strokeColor string = "#000000" optional

Returns

WordShape
public static WordShape AddPolygon(WordParagraph paragraph, string points, OfficeColor fillColor, OfficeColor strokeColor) #

Adds a polygon shape using OfficeColor values.

Parameters

paragraph OfficeIMO.Word.WordParagraph required
points string required
fillColor OfficeIMO.OfficeColor required
strokeColor OfficeIMO.OfficeColor required

Returns

WordShape
public 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 required
width OfficeIMO.OfficeLength required
height OfficeIMO.OfficeLength required
fillColor OfficeIMO.OfficeColor? = null optional
arcSize double = 0.25 optional

Returns

WordShape
public void Remove() #

Removes the shape from the paragraph.

public bool TryGetLayoutSnapshot(out WordDrawingLayoutInfo snapshot) #

Reads persisted inline or anchored package geometry for this DrawingML shape.

Parameters

snapshot OfficeIMO.Word.WordDrawingLayoutInfo required
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.

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 Id { get; set; } #

Identifier of the shape.

public string? Title { get; set; } #

Optional title of the shape.

public string? Description { get; set; } #

Alternative text description of the shape.

public bool? Hidden { get; set; } #

Whether the shape is hidden. Stored as "visibility:hidden" in the style string.

public double? ArcSize { get; set; } #

Corner roundness as a fraction between 0 and 1 for rounded rectangles.

public bool? Stroked { get; set; } #

Determines whether the outline is drawn.

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.