OfficeIMO

API Reference

Class

WordShape

Namespace OfficeIMO.Word
Assembly OfficeIMO.Word

Represents simple shapes inside a paragraph.

Inheritance

Constructors

WordShape 2 overloads
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 required
arg2 OfficeIMO.Word.WordParagraph required
arg3 System.Double required
arg4 System.Double required
arg5 System.String required
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 required
arg2 DocumentFormat.OpenXml.Wordprocessing.Paragraph required
arg3 DocumentFormat.OpenXml.Wordprocessing.Run required
arg4 DocumentFormat.OpenXml.Wordprocessing.Drawing required

Methods

public static WordShape AddDrawingShape(WordParagraph paragraph, ShapeType shapeType, Double widthPt, Double heightPt) #
Returns: WordShape

Adds a DrawingML shape to the given paragraph.

Parameters

paragraph OfficeIMO.Word.WordParagraph requiredposition: 0
Paragraph to append the shape to.
shapeType OfficeIMO.Word.ShapeType requiredposition: 1
Type of shape to create.
widthPt System.Double requiredposition: 2
Width in points.
heightPt System.Double requiredposition: 3
Height in points.
public static WordShape AddDrawingShapeAnchored(WordParagraph paragraph, ShapeType shapeType, Double widthPt, Double heightPt, Double leftPt, Double topPt) #
Returns: WordShape

Adds a DrawingML shape anchored at an absolute position on the page.

Parameters

paragraph OfficeIMO.Word.WordParagraph requiredposition: 0
Paragraph to host the drawing anchor.
shapeType OfficeIMO.Word.ShapeType requiredposition: 1
Type of shape.
widthPt System.Double requiredposition: 2
Width in points.
heightPt System.Double requiredposition: 3
Height in points.
leftPt System.Double requiredposition: 4
Left offset in points from the page.
topPt System.Double requiredposition: 5
Top offset in points from the page.
AddEllipse 2 overloads
public static WordShape AddEllipse(WordParagraph paragraph, Double widthPt, Double heightPt, Color fillColor) #
Returns: WordShape

Adds an ellipse shape to the given paragraph.

Parameters

paragraph OfficeIMO.Word.WordParagraph requiredposition: 0
widthPt System.Double requiredposition: 1
heightPt System.Double requiredposition: 2
fillColor System.String = "#FFFFFF" requiredposition: 3
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 required
widthPt System.Double required
heightPt System.Double required
fillColor SixLabors.ImageSharp.Color required
AddLine 2 overloads
public static WordShape AddLine(WordParagraph paragraph, Double startXPt, Double startYPt, Double endXPt, Double endYPt, Color color, Double strokeWeightPt = 1) #
Returns: WordShape

Adds a line shape to the given paragraph.

Parameters

paragraph OfficeIMO.Word.WordParagraph requiredposition: 0
startXPt System.Double requiredposition: 1
startYPt System.Double requiredposition: 2
endXPt System.Double requiredposition: 3
endYPt System.Double requiredposition: 4
color System.String = "#000000" requiredposition: 5
strokeWeightPt System.Double = 1 optionalposition: 6
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 required
startXPt System.Double required
startYPt System.Double required
endXPt System.Double required
endYPt System.Double required
color SixLabors.ImageSharp.Color required
strokeWeightPt System.Double required
AddPolygon 2 overloads
public static WordShape AddPolygon(WordParagraph paragraph, String points, Color fillColor, Color strokeColor) #
Returns: WordShape

Adds a polygon shape to the given paragraph.

Parameters

paragraph OfficeIMO.Word.WordParagraph requiredposition: 0
points System.String requiredposition: 1
fillColor System.String = "#FFFFFF" requiredposition: 2
strokeColor System.String = "#000000" requiredposition: 3
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 required
points System.String required
fillColor SixLabors.ImageSharp.Color required
strokeColor SixLabors.ImageSharp.Color required
public static WordShape AddRoundedRectangle(WordParagraph paragraph, Double widthPt, Double heightPt, String fillColor = "#FFFFFF", Double arcSize = 0.25) #
Returns: WordShape

Adds a rounded rectangle shape to the given paragraph.

Parameters

paragraph OfficeIMO.Word.WordParagraph requiredposition: 0
widthPt System.Double requiredposition: 1
heightPt System.Double requiredposition: 2
fillColor System.String = "#FFFFFF" optionalposition: 3
arcSize System.Double = 0.25 optionalposition: 4
public Void Remove() #
Returns: Void

Removes the shape from the paragraph.

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 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 Nullable<Boolean> Hidden { get; set; } #

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

public String StrokeColorHex { get; set; } #

Outline color in hex format (no leading '#', lowercase). Null when not applicable.

public Color StrokeColor { get; set; } #

Outline color using Color.

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

Width of the shape in points.

public Double Height { get; set; } #

Height of the shape in points.

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.