Search Results for

    Show / Hide Table of Contents

    Class ImageContent

    Represents an image element within the document.

    Inheritance
    System.Object
    ContentElement
    ImageContent
    Implements
    IronSoftware.Abstractions.IDocumentElement
    IWordImageObject
    IWordDocumentObject
    IronSoftware.IDocumentObject
    IronSoftware.IDocumentImageObject
    IronSoftware.IBoundedDocumentObject
    IronSoftware.IBounded
    IronSoftware.ITransformable
    System.ICloneable
    IronSoftware.IJsonSerializable
    Inherited Members
    ContentElement.Status
    ContentElement.Replace(ContentElement)
    ContentElement.Remove()
    ContentElement.GetIndex<T>()
    ContentElement.Clone()
    ContentElement.CloneObject()
    ContentElement.Parent
    Namespace: IronWord.Models
    Assembly: IronWord.dll
    Syntax
    public class ImageContent : ContentElement, IDocumentElement, IWordImageObject, IWordDocumentObject, IDocumentObject, IDocumentImageObject, IBoundedDocumentObject, IBounded, ITransformable, ICloneable, IJsonSerializable

    Constructors

    ImageContent()

    Initializes a new instance of the Image class.

    Declaration
    public ImageContent()

    ImageContent(AnyBitmap)

    Initializes a new instance of the Image class using an IronSoftware.Drawing.AnyBitmap object.

    Declaration
    public ImageContent(AnyBitmap anyBitmap)
    Parameters
    Type Name Description
    IronSoftware.Drawing.AnyBitmap anyBitmap

    An IronSoftware.Drawing.AnyBitmap object representing the image data.

    ImageContent(Stream)

    Initializes a new instance of the Image class with the specified image data stream.

    Declaration
    public ImageContent(Stream imageStream)
    Parameters
    Type Name Description
    System.IO.Stream imageStream

    The stream containing the image data.

    ImageContent(String)

    Initializes a new instance of the Image class with the specified image path.

    Declaration
    public ImageContent(string imagePath)
    Parameters
    Type Name Description
    System.String imagePath

    The path to the image file.

    Properties

    BoundingBox

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

    DistanceFromBottom

    Gets or sets the distance from the bottom edge of the document to the image, measured in 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 image, measured in 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 image, measured in 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 image, measured in points.

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

    DocumentId

    Declaration
    public IDocumentId DocumentId { get; set; }
    Property Value
    Type Description
    IronSoftware.IDocumentId

    Height

    Gets or sets the height of the image in pixels measured in points (1 inch = 72 points).

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

    Id

    Gets or sets a unique identifier for the image.

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

    Image

    Declaration
    public IAnyImage Image { get; set; }
    Property Value
    Type Description
    IronSoftware.IAnyImage

    ImageData

    Gets or sets the Base64-encoded image data.

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

    Index

    Gets the index of this image within the parent's list of children.

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

    Matrix

    Declaration
    public MatrixStruct Matrix { get; }
    Property Value
    Type Description
    IronSoftware.MatrixStruct

    Name

    Gets or sets the name of the image file, if applicable.

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

    ObjNum

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

    PageIndex

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

    Position

    Gets or sets the position of the image within the document measured in points (1 inch = 72 points).

    Declaration
    public ElementPosition Position { get; set; }
    Property Value
    Type Description
    ElementPosition

    Rotation

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

    Scale

    Declaration
    public PointF Scale { get; set; }
    Property Value
    Type Description
    System.Drawing.PointF

    Translate

    Declaration
    public PointF Translate { get; set; }
    Property Value
    Type Description
    System.Drawing.PointF

    Type

    Gets or sets the image format.

    Declaration
    public ImageType Type { get; set; }
    Property Value
    Type Description
    ImageType

    Width

    Gets or sets the width of the image in points (1 inch = 72 points).

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

    WrapText

    Gets or sets the text wrapping behavior around the image.

    Declaration
    public WrapText WrapText { get; set; }
    Property Value
    Type Description
    WrapText

    Methods

    GetDistanceFromBottom(MeasurementUnit)

    Get the distance from the bottom edge of the document to the image.

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

    The unit of measurement for the distance.

    Returns
    Type Description
    System.Double

    Distance from the bottom edge of the document to the image.

    GetDistanceFromLeft(MeasurementUnit)

    Get the distance from the left edge of the document to the image.

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

    The unit of measurement for the distance.

    Returns
    Type Description
    System.Double

    Distance from the left edge of the document to the image.

    GetDistanceFromRight(MeasurementUnit)

    Get the distance from the right edge of the document to the image.

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

    The unit of measurement for the distance.

    Returns
    Type Description
    System.Double

    Distance from the right edge of the document to the image.

    GetDistanceFromTop(MeasurementUnit)

    Get the distance from the top edge of the document to the image.

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

    The unit of measurement for the distance.

    Returns
    Type Description
    System.Double

    Image distance from the top edge of the document in specified measurement unit.

    GetHeight(MeasurementUnit)

    Get image height.

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

    The unit of measurement to return the value in.

    Returns
    Type Description
    System.Double

    Image height in specified measurement unit.

    GetWidth(MeasurementUnit)

    Get image width.

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

    The unit of measurement to return the value in.

    Returns
    Type Description
    System.Double

    Image width in specified measurement unit.

    LoadFromFile(String)

    Loads an image from the specified file path.

    Declaration
    public void LoadFromFile(string imagePath)
    Parameters
    Type Name Description
    System.String imagePath

    The file path of the image to be loaded.

    Remarks

    This method attempts to load an image from the specified file path. If the file is not found, a System.IO.FileNotFoundException is thrown. Any other exceptions during the loading process are wrapped in an ImageLoadException.

    Exceptions
    Type Condition
    System.IO.FileNotFoundException

    Thrown if the specified image file is not found.

    ImageLoadException

    Thrown if there is an error loading the image.

    LoadFromStream(Stream)

    Loads an image from the stream.

    Declaration
    public void LoadFromStream(Stream stream)
    Parameters
    Type Name Description
    System.IO.Stream stream

    The stream to be loaded.

    Remarks

    This method attempts to load an image from the specified file path. If the file is not found, a System.IO.FileNotFoundException is thrown. Any other exceptions during the loading process are wrapped in an ImageLoadException.

    Exceptions
    Type Condition
    ImageLoadException

    Thrown if there is an error loading the image.

    SetDistanceFromBottom(Double, MeasurementUnit)

    Set the distance from the bottom edge of the document to the image.

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

    Distance from the bottom edge of the document to the image.

    MeasurementUnit measurementUnit

    The unit of measurement for the distance.

    SetDistanceFromLeft(Double, MeasurementUnit)

    Set the distance from the left edge of the document to the image.

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

    Distance from the left edge of the document to the image.

    MeasurementUnit measurementUnit

    The unit of measurement for the distance.

    SetDistanceFromRight(Double, MeasurementUnit)

    Set the distance from the right edge of the document to the image.

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

    Distance from the right edge of the document to the image.

    MeasurementUnit measurementUnit

    The unit of measurement for the distance.

    SetDistanceFromTop(Double, MeasurementUnit)

    Set the distance from the top edge of the document to the image.

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

    Distance from the top edge of the document to the image.

    MeasurementUnit measurementUnit

    The unit of measurement for the distance.

    SetHeight(Double, MeasurementUnit)

    Set image height.

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

    The desired height for the image.

    MeasurementUnit measurementUnit

    The unit of measurement for the height.

    SetWidth(Double, MeasurementUnit)

    Set image width.

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

    The desired width for the image.

    MeasurementUnit measurementUnit

    The unit of measurement for the width.

    ToJson()

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

    Implements

    IronSoftware.Abstractions.IDocumentElement
    IWordImageObject
    IWordDocumentObject
    IronSoftware.IDocumentObject
    IronSoftware.IDocumentImageObject
    IronSoftware.IBoundedDocumentObject
    IronSoftware.IBounded
    IronSoftware.ITransformable
    System.ICloneable
    IronSoftware.IJsonSerializable

    Inherited members

    Status
    Replace(ContentElement)
    Remove()
    GetIndex<T>()
    Clone()
    CloneObject()
    Parent
    ☀
    ☾
    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.