Search Results for

    Show / Hide Table of Contents

    Class ShapeContent

    Represents a shape within the document, primarily defined using SVG format.

    Inheritance
    System.Object
    ContentElement
    ShapeContent
    Implements
    IWordShapeObject
    IronSoftware.Abstractions.Word.IShape
    IronSoftware.Abstractions.Word.IWordDocumentObject
    IronSoftware.Abstractions.IDocumentObject
    System.ICloneable
    IronSoftware.Abstractions.IColored
    IronSoftware.Abstractions.Word.IWordAbsolute
    IronSoftware.Abstractions.IAbsolute
    IronSoftware.Abstractions.IJsonSerializable
    Inherited Members
    ContentElement.Replace(IWordDocumentObject)
    ContentElement.Remove()
    ContentElement.GetIndex<T>()
    ContentElement.Clone()
    ContentElement.CloneObject()
    ContentElement.Parent
    ContentElement.Status
    Namespace: IronWord.Models
    Assembly: IronWord.dll
    Syntax
    public class ShapeContent : ContentElement, IWordShapeObject, IShape, IWordDocumentObject, IDocumentObject, ICloneable, IColored, IWordAbsolute, IAbsolute, IJsonSerializable

    Constructors

    ShapeContent(ShapeType, RectangleF)

    Initialize a ShapeContent object.

    Declaration
    public ShapeContent(ShapeType shapeType, RectangleF boundingBox)
    Parameters
    Type Name Description
    IronSoftware.Abstractions.Word.ShapeType shapeType

    The type of shape.

    System.Drawing.RectangleF boundingBox

    The bounding box of the shape.

    ShapeContent(ShapeType, RectangleF, Color, Color)

    Initialize a ShapeContent object.

    Declaration
    public ShapeContent(ShapeType shapeType, RectangleF boundingBox, Color fillColor, Color strokeColor)
    Parameters
    Type Name Description
    IronSoftware.Abstractions.Word.ShapeType shapeType

    The type of shape.

    System.Drawing.RectangleF boundingBox

    The bounding box of the shape.

    Color fillColor

    The fill color.

    Color strokeColor

    The stroke color.

    ShapeContent(List<IPathSegment>)

    Initialize a ShapeContent object.

    Declaration
    public ShapeContent(List<IPathSegment> points)
    Parameters
    Type Name Description
    System.Collections.Generic.List<IronSoftware.Abstractions.IPathSegment> points

    The points of the shape.

    Remarks

    Initializing with just points will set the ShapeType as "Custom".

    ShapeContent(List<IPathSegment>, Color, Color)

    Initialize a ShapeContent object.

    Declaration
    public ShapeContent(List<IPathSegment> points, Color fillColor, Color strokeColor)
    Parameters
    Type Name Description
    System.Collections.Generic.List<IronSoftware.Abstractions.IPathSegment> points

    The points of the shape.

    Color fillColor

    The fill color.

    Color strokeColor

    The stroke color.

    Properties

    Angle

    Gets or sets rotation Angle for the shape in the document.

    Declaration
    public double Angle { get; set; }
    Property Value
    Type Description
    System.Double
    Remarks

    Unit are 'degrees' with range of values between 0 and 360, any negative or larger values will be normalized to that range.

    BoundingBox

    The bounding box of the shape.

    Declaration
    public RectangleF BoundingBox { get; set; }
    Property Value
    Type Description
    System.Drawing.RectangleF
    Remarks

    Position and dimensions are represented in pts.

    DistanceFromBottom

    Gets or sets the distance from the bottom edge of the document to the Shape measured in points (1 inch = 72 points).

    Declaration
    public double DistanceFromBottom { get; set; }
    Property Value
    Type Description
    System.Double

    DistanceFromLeft

    Gets or sets the distance from the left edge of the document to the Shape measured in points (1 inch = 72 points).

    Declaration
    public double DistanceFromLeft { get; set; }
    Property Value
    Type Description
    System.Double

    DistanceFromRight

    Gets or sets the distance from the right edge of the document to the Shape measured in points (1 inch = 72 points).

    Declaration
    public double DistanceFromRight { get; set; }
    Property Value
    Type Description
    System.Double

    DistanceFromTop

    Gets or sets the distance from the top edge of the document to the Shape measured in points (1 inch = 72 points).

    Declaration
    public double DistanceFromTop { get; set; }
    Property Value
    Type Description
    System.Double

    FillColor

    Gets or sets the fill color of the shape.

    Declaration
    public Color FillColor { get; set; }
    Property Value
    Type Description
    Color

    FlipHorizontal

    Flip the shape horizontally.

    Declaration
    public bool FlipHorizontal { get; set; }
    Property Value
    Type Description
    System.Boolean

    FlipVertical

    Flip the shape vertically.

    Declaration
    public bool FlipVertical { get; set; }
    Property Value
    Type Description
    System.Boolean

    Height

    The height of the shape in pts.

    Declaration
    public double Height { get; }
    Property Value
    Type Description
    System.Double

    HorizontalAlignment

    Gets or sets the horizontal alignment of the shape within its containing element.

    Declaration
    public HorizontalAlignment HorizontalAlignment { get; set; }
    Property Value
    Type Description
    IronSoftware.Abstractions.Word.HorizontalAlignment

    HorizontalRelativePositionOrigin

    Declaration
    public HorizontalRelativePositionOrigin HorizontalRelativePositionOrigin { get; set; }
    Property Value
    Type Description
    IronSoftware.Abstractions.Word.HorizontalRelativePositionOrigin

    Id

    Gets or sets a unique identifier for the shape in the document.

    Declaration
    public uint Id { get; set; }
    Property Value
    Type Description
    System.UInt32

    Index

    The index of this ShapeContent in Children.

    Declaration
    public int Index { get; }
    Property Value
    Type Description
    System.Int32

    Name

    Gets or sets the Name of the shape in the document.

    Declaration
    public string Name { get; set; }
    Property Value
    Type Description
    System.String

    Points

    The points that make up the shape.

    Declaration
    public List<IPathSegment> Points { get; }
    Property Value
    Type Description
    System.Collections.Generic.List<IronSoftware.Abstractions.IPathSegment>

    StrokeColor

    Gets or sets the Stroke Color of the shape.

    Declaration
    public Color StrokeColor { get; set; }
    Property Value
    Type Description
    Color

    StrokeWeight

    The stroke weight of the shape in points (1 inch = 72 points).

    Declaration
    public int StrokeWeight { get; set; }
    Property Value
    Type Description
    System.Int32

    TextWrapBehavior

    Declaration
    public ITextWrapBehavior TextWrapBehavior { get; set; }
    Property Value
    Type Description
    IronSoftware.Abstractions.Word.ITextWrapBehavior

    Type

    Declaration
    public ShapeType Type { get; set; }
    Property Value
    Type Description
    IronSoftware.Abstractions.Word.ShapeType

    VerticalAlignment

    Gets or sets the vertical alignment of the shape within its containing element.

    Declaration
    public VerticalAlignment VerticalAlignment { get; set; }
    Property Value
    Type Description
    IronSoftware.Abstractions.Word.VerticalAlignment

    VerticalRelativePositionOrigin

    Declaration
    public VerticalRelativePositionOrigin VerticalRelativePositionOrigin { get; set; }
    Property Value
    Type Description
    IronSoftware.Abstractions.Word.VerticalRelativePositionOrigin

    Width

    The width of the shape in pts.

    Declaration
    public double Width { get; }
    Property Value
    Type Description
    System.Double

    ZOrder

    Declaration
    public RelativeZOrder ZOrder { get; set; }
    Property Value
    Type Description
    IronSoftware.Abstractions.RelativeZOrder

    ZPosition

    Declaration
    public long ZPosition { get; set; }
    Property Value
    Type Description
    System.Int64

    Methods

    GetDistanceFromBottom(MeasurementUnit)

    Declaration
    public double GetDistanceFromBottom(MeasurementUnit measurementUnit)
    Parameters
    Type Name Description
    MeasurementUnit measurementUnit
    Returns
    Type Description
    System.Double

    GetDistanceFromLeft(MeasurementUnit)

    Declaration
    public double GetDistanceFromLeft(MeasurementUnit measurementUnit)
    Parameters
    Type Name Description
    MeasurementUnit measurementUnit
    Returns
    Type Description
    System.Double

    GetDistanceFromRight(MeasurementUnit)

    Declaration
    public double GetDistanceFromRight(MeasurementUnit measurementUnit)
    Parameters
    Type Name Description
    MeasurementUnit measurementUnit
    Returns
    Type Description
    System.Double

    GetDistanceFromTop(MeasurementUnit)

    Declaration
    public double GetDistanceFromTop(MeasurementUnit measurementUnit)
    Parameters
    Type Name Description
    MeasurementUnit measurementUnit
    Returns
    Type Description
    System.Double

    GetHeight(MeasurementUnit)

    Declaration
    public double GetHeight(MeasurementUnit measurementUnit)
    Parameters
    Type Name Description
    MeasurementUnit measurementUnit
    Returns
    Type Description
    System.Double

    GetWidth(MeasurementUnit)

    Get the width of the shape in specified measurement unit.

    Declaration
    public double GetWidth(MeasurementUnit measurementUnit)
    Parameters
    Type Name Description
    MeasurementUnit measurementUnit

    Measurement unit.

    Returns
    Type Description
    System.Double

    Resize(Int32, Int32)

    Resizes the shape.

    Declaration
    public void Resize(int width, int height)
    Parameters
    Type Name Description
    System.Int32 width

    New width in points (1 inch = 72 points).

    System.Int32 height

    New height in points (1 inch = 72 points).

    Rotate(Double)

    Rotates the shape by a specified angle.

    Declaration
    public void Rotate(double angle)
    Parameters
    Type Name Description
    System.Double angle

    The angle in degrees.

    Remarks

    Unit is 'degrees' with a range of values between 0 and 360, any negative or larger values will be normalized to that range.

    SetDistanceFromBottom(Double, MeasurementUnit)

    Declaration
    public void SetDistanceFromBottom(double distanceFromBottom, MeasurementUnit measurementUnit)
    Parameters
    Type Name Description
    System.Double distanceFromBottom
    MeasurementUnit measurementUnit

    SetDistanceFromLeft(Double, MeasurementUnit)

    Declaration
    public void SetDistanceFromLeft(double distanceFromLeft, MeasurementUnit measurementUnit)
    Parameters
    Type Name Description
    System.Double distanceFromLeft
    MeasurementUnit measurementUnit

    SetDistanceFromRight(Double, MeasurementUnit)

    Declaration
    public void SetDistanceFromRight(double distanceFromRight, MeasurementUnit measurementUnit)
    Parameters
    Type Name Description
    System.Double distanceFromRight
    MeasurementUnit measurementUnit

    SetDistanceFromTop(Double, MeasurementUnit)

    Declaration
    public void SetDistanceFromTop(double distanceFromTop, MeasurementUnit measurementUnit)
    Parameters
    Type Name Description
    System.Double distanceFromTop
    MeasurementUnit measurementUnit

    SetHeight(Double, MeasurementUnit)

    Declaration
    public void SetHeight(double height, MeasurementUnit measurementUnit)
    Parameters
    Type Name Description
    System.Double height
    MeasurementUnit measurementUnit

    SetWidth(Double, MeasurementUnit)

    Declaration
    public void SetWidth(double width, MeasurementUnit measurementUnit)
    Parameters
    Type Name Description
    System.Double width
    MeasurementUnit measurementUnit

    ToJson()

    Serialize this shape as a JSON object.

    Declaration
    public string ToJson()
    Returns
    Type Description
    System.String

    Implements

    IWordShapeObject
    IronSoftware.Abstractions.Word.IShape
    IronSoftware.Abstractions.Word.IWordDocumentObject
    IronSoftware.Abstractions.IDocumentObject
    System.ICloneable
    IronSoftware.Abstractions.IColored
    IronSoftware.Abstractions.Word.IWordAbsolute
    IronSoftware.Abstractions.IAbsolute
    IronSoftware.Abstractions.IJsonSerializable

    Inherited members

    Replace(IWordDocumentObject)
    Remove()
    GetIndex<T>()
    Clone()
    CloneObject()
    Parent
    Status
    ☀
    ☾
    Downloads
    • Download with NuGet
    • Start for Free
    In This Article
    Back to top
    Install with NuGet
    Want to deploy IronWord to a live project for FREE?
    What’s included?
    30 days of fully-functional product
    Test and share in a live environment
    No watermarks in production
    Get your free 30-day Trial Key instantly.
    No credit card or account creation required
    Your Trial License Key has been emailed to you.
    Download IronWord free to apply
    your Trial Licenses Key
    Install with NuGet View Licenses
    Licenses from $499. Have a question? Get in touch.