menu

Xamarin.Forms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class WPicture - Xamarin.Forms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class WPicture

    Represents the picture in the Word document.

    Inheritance
    System.Object
    OwnerHolder
    XDLSSerializableBase
    Entity
    WidgetBase
    ParagraphItem
    WPicture
    Implements
    IXDLSSerializable
    IOfficeRun
    IWPicture
    IParagraphItem
    IEntity
    Inherited Members
    Entity.Clone()
    Entity.IsComposite
    Entity.NextSibling
    Entity.Owner
    Entity.PreviousSibling
    OwnerHolder.Document
    OwnerHolder.m_doc
    ParagraphItem.ApplyStyle(String)
    ParagraphItem.CloneRun()
    ParagraphItem.Dispose()
    ParagraphItem.IsDeleteRevision
    ParagraphItem.IsInsertRevision
    ParagraphItem.m_charFormat
    ParagraphItem.OwnerMathRunElement
    ParagraphItem.OwnerParagraph
    XDLSSerializableBase.IXDLSSerializable.ReadXmlAttributes(IXDLSAttributeReader)
    XDLSSerializableBase.IXDLSSerializable.ReadXmlContent(IXDLSContentReader)
    XDLSSerializableBase.IXDLSSerializable.RestoreReference(String, Int32)
    XDLSSerializableBase.IXDLSSerializable.WriteXmlAttributes(IXDLSAttributeWriter)
    XDLSSerializableBase.IXDLSSerializable.WriteXmlContent(IXDLSContentWriter)
    XDLSSerializableBase.IXDLSSerializable.XDLSHolder
    XDLSSerializableBase.RestoreReference(String, Int32)
    XDLSSerializableBase.XDLSHolder
    Namespace: Syncfusion.DocIO.DLS
    Assembly: Syncfusion.DocIO.Portable.dll
    Syntax
    public class WPicture : ParagraphItem, IXDLSSerializable, IOfficeRun, ILeafWidget, IWidget, IWPicture, IParagraphItem, IEntity
    Examples
    private void Button1_Click(System.Object sender, System.EventArgs e)
    {
        //Create a new Word document 
        WordDocument document = new WordDocument();
        //Add new section to the document
        IWSection section = document.AddSection();
        //Add new paragraph to the section
        IWParagraph paragraph = section.AddParagraph();
        paragraph.AppendText("This paragraph has picture. ");
        //Append new picture to the paragraph
        IWPicture picture = paragraph.AppendPicture(Image.FromFile("Image.png"));            
        //Set width and height for the paragraph
        picture.Width = 150;
        picture.Height = 100;
        //Set text wrapping style – When the wrapping style is inline the images will not be absolutely positioned. It will be added next to the textrange.
        picture.TextWrappingStyle = TextWrappingStyle.Square;
        picture.TextWrappingType = TextWrappingType.Largest;
        //Set horizontal and vertical origin
        picture.HorizontalOrigin = HorizontalOrigin.Page;
        picture.VerticalOrigin = VerticalOrigin.Paragraph;
        //Set horizontal and vertical position for the picture
        picture.HorizontalPosition = 200;
        picture.VerticalPosition = 150;
        //Set horizontal and vertical alignments
        picture.HorizontalAlignment = ShapeHorizontalAlignment.Center;
        picture.VerticalAlignment = ShapeVerticalAlignment.Bottom;
        //Set name, title, alternate text.
        picture.Title = "PictureTitle";
        picture.Name = "PictureName";
        picture.IsBelowText = true;            
        //Save the Word document
        document.Save("Sample.docx", FormatType.Docx);
        //Close the document
        document.Close();
    }
    Private Sub button_Click(sender As Object, e As EventArgs)
        'Create a new Word document 
        Dim document As New WordDocument()
        'Add new section to the document
        Dim section As IWSection = document.AddSection()
        'Add new paragraph to the section
        Dim paragraph As IWParagraph = section.AddParagraph()
        paragraph.AppendText("This paragraph has picture. ")
        'Append new picture to the paragraph
        Dim picture As IWPicture = paragraph.AppendPicture(Image.FromFile("Image.png"))
        'Set width and height for the paragraph
        picture.Width = 150
        picture.Height = 100
        'Set text wrapping style – When the wrapping style is inline the images will not be absolutely positioned. It will be added next to the textrange.
        picture.TextWrappingStyle = TextWrappingStyle.Square
        picture.TextWrappingType = TextWrappingType.Largest
        'Set horizontal and vertical origin
        picture.HorizontalOrigin = HorizontalOrigin.Page
        picture.VerticalOrigin = VerticalOrigin.Paragraph
        'Set horizontal and vertical position for the picture
        picture.HorizontalPosition = 200
        picture.VerticalPosition = 150
        'Set horizontal and vertical alignments
        picture.HorizontalAlignment = ShapeHorizontalAlignment.Center
        picture.VerticalAlignment = ShapeVerticalAlignment.Bottom
        'Set name, title, alternate text.
        picture.Title = "PictureTitle"
        picture.Name = "PictureName"
        picture.IsBelowText = True
        'Save the Word document
        document.Save("Sample.docx", FormatType.Docx)
        'Close the document
        document.Close()
    End Sub

    Constructors

    WPicture(IWordDocument)

    Initializes a new instance of the WPicture class with the specified IWordDocument instance.

    Declaration
    public WPicture(IWordDocument doc)
    Parameters
    Type Name Description
    IWordDocument doc

    The IWordDocument instance.

    Properties

    AlternativeText

    Gets or sets the alternate text for the picture.

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

    The string that represents the alternate text.

    CharacterFormat

    Gets the character format(font properties) of the picture. Read-only.

    Declaration
    public WCharacterFormat CharacterFormat { get; }
    Property Value
    Type
    WCharacterFormat

    EntityType

    Gets the type of the entity. Read-only.

    Declaration
    public override EntityType EntityType { get; }
    Property Value
    Type Description
    EntityType

    The EntityType of the current item.

    Overrides
    Entity.EntityType

    FlipHorizontal

    Gets or sets a Horizontal flipping of Picture.

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

    true indicates that a picture has been flipped horizontally; otherwise, false.

    Remarks

    This property returns True if the specified picture is flipped around the horizontal axis, and False if not.

    Examples

    The following code example demonstrates how to gets or sets the horizontal flip to picture.

        //Creates a new Word document 
        WordDocument document = new WordDocument();
        //Adds new section to the document
        IWSection section = document.AddSection();
        //Adds new text to the paragraph 
        IWParagraph paragraph = section.AddParagraph();
        //Gets the image and convert to byte array  
        Image image = Image.FromFile("Image.png");
        MemoryStream imageStream = new MemoryStream();
        image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png);
        byte[] imageBytes = imageStream.ToArray();
        //Initializes new picture 
        WPicture picture = new WPicture(document);
        //Loads an image from the byte array  
        picture.LoadImage(imageBytes);
        //Sets height and width for the image 
        picture.Height = 100;
        picture.Width = 150;
        //Sets horizontal flip to the picture
        picture.FlipHorizontal = true;
        //Adds image to the paragraph 
        paragraph.Items.Add(picture);
        //Saves the Word document  
        document.Save("Sample.docx", FormatType.Docx);
        //Closes the document  
        document.Close();
        'Creates a New Word document 
        Dim document As WordDocument = New WordDocument
        'Adds new section to the document
        Dim section As IWSection = document.AddSection
        'Adds new text to the paragraph 
        Dim paragraph As IWParagraph = section.AddParagraph
        'Gets the image and convert to byte array   
        Dim image As Image = Image.FromFile("Image.png")
        Dim imageStream As MemoryStream = New MemoryStream
        image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png)
        Dim imageBytes() As Byte = imageStream.ToArray
        'Initializes new picture 
        Dim picture As WPicture = New WPicture(document)
        'Loads an image from the byte array  
        picture.LoadImage(imageBytes)
        'Sets height and width for the image 
        picture.Height = 100
        picture.Width = 150
        'Sets horizontal flip to the picture
        picture.FlipHorizontal = True
        'Adds image to the paragraph 
        paragraph.Items.Add(picture)
        'Saves the Word document  
        document.Save("Sample.docx", FormatType.Docx)
        'Closes the document  
        document.Close()

    FlipVertical

    Gets or sets a Vertical flipping of Picture.

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

    true indicates that a picture has been flipped vertically; otherwise, false.

    Remarks

    This property returns True if the specified picture is flipped around the vertical axis, and False if not.

    Examples

    The following code example demonstrates how to gets or sets the vertical flip to picture.

        //Creates a new Word document 
        WordDocument document = new WordDocument();
        //Adds new section to the document
        IWSection section = document.AddSection();
        //Adds new text to the paragraph 
        IWParagraph paragraph = section.AddParagraph();
        //Gets the image and convert to byte array  
        Image image = Image.FromFile("Image.png");
        MemoryStream imageStream = new MemoryStream();
        image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png);
        byte[] imageBytes = imageStream.ToArray();
        //Initializes new picture 
        WPicture picture = new WPicture(document);
        //Loads an image from the byte array  
        picture.LoadImage(imageBytes);
        //Sets height and width for the image 
        picture.Height = 100;
        picture.Width = 150;
        //Sets vertical flip to the picture
        picture.FlipVertical = true;
        //Adds image to the paragraph 
        paragraph.Items.Add(picture);
        //Saves the Word document  
        document.Save("Sample.docx", FormatType.Docx);
        //Closes the document  
        document.Close();
        'Creates a New Word document 
        Dim document As WordDocument = New WordDocument
        'Adds new section to the document
        Dim section As IWSection = document.AddSection
        'Adds new text to the paragraph 
        Dim paragraph As IWParagraph = section.AddParagraph
        'Gets the image and convert to byte array   
        Dim image As Image = Image.FromFile("Image.png")
        Dim imageStream As MemoryStream = New MemoryStream
        image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png)
        Dim imageBytes() As Byte = imageStream.ToArray
        'Initializes new picture 
        Dim picture As WPicture = New WPicture(document)
        'Loads an image from the byte array  
        picture.LoadImage(imageBytes)
        'Sets height and width for the image 
        picture.Height = 100
        picture.Width = 150
        'Sets vertical flip to the picture
        picture.FlipVertical = True
        'Adds image to the paragraph 
        paragraph.Items.Add(picture)
        'Saves the Word document  
        document.Save("Sample.docx", FormatType.Docx)
        'Closes the document  
        document.Close()

    Height

    Gets or sets the picture height in points

    Declaration
    public float Height { get; set; }
    Property Value
    Type Description
    System.Single

    The float that specifies the height.

    HeightScale

    Gets or sets the picture height scale factor in percent.

    Declaration
    public float HeightScale { get; set; }
    Property Value
    Type Description
    System.Single

    The float that specifies the height scale factor.

    HorizontalAlignment

    Gets or sets the horizontal alignment of the picture.

    Declaration
    public ShapeHorizontalAlignment HorizontalAlignment { get; set; }
    Property Value
    Type Description
    ShapeHorizontalAlignment

    The ShapeHorizontalAlignment member that specifies the horizontal alignment.

    Remarks

    If the alignment is set as None, then the picture is explicitly positioned using position properties. Otherwise it is positioned according to the alignment specified. The position of the object is relative to HorizontalOrigin.

    HorizontalOrigin

    Gets or sets the horizontal origin of the picture.

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

    The HorizontalOrigin member that specifies the horizontal origin.

    HorizontalPosition

    Gets or sets absolute horizontal position of the picture in points.

    Declaration
    public float HorizontalPosition { get; set; }
    Property Value
    Type Description
    System.Single

    The float that specifies the horizontal position.

    Remarks

    The horizontal position is relative to the HorizontalOrigin.

    ImageBytes

    Gets the image as byte array. Read-only.

    Declaration
    public byte[] ImageBytes { get; }
    Property Value
    Type Description
    System.Byte[]

    The System.Byte array that represents image bytes.

    IsBelowText

    Gets or sets a value indicating whether the picture is below the text.

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

    True if the picture is below text; otherwise, false.

    LockAspectRatio

    Gets or sets a value indicating whether the pictute has Lock aspect ratio. The default is false.

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

    true if this instance has lock aspect ratio; otherwise, false.

    Name

    Gets or sets the name of the picture.

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

    The string that represents the name.

    Rotation

    Gets or sets the picture rotation in degree.

    Declaration
    public float Rotation { get; set; }
    Property Value
    Type Description
    System.Single

    The float that specifies the rotation value of the picture.

    Remarks

    A positive value indicates clockwise rotation; a negative value indicates counterclockwise rotation.

    Examples

    The following code example demonstrates how to gets or sets the rotation value of picture in degree.

        //Creates a new Word document 
        WordDocument document = new WordDocument();
        //Adds new section to the document
        IWSection section = document.AddSection();
        //Adds new text to the paragraph 
        IWParagraph paragraph = section.AddParagraph();
        //Gets the image and convert to byte array  
        Image image = Image.FromFile("Image.png");
        MemoryStream imageStream = new MemoryStream();
        image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png);
        byte[] imageBytes = imageStream.ToArray();
        //Initializes new picture 
        WPicture picture = new WPicture(document);
        //Loads an image from the byte array  
        picture.LoadImage(imageBytes);
        //Sets height and width for the image 
        picture.Height = 100;
        picture.Width = 150;
        //Sets picture rotation in degree  
        picture.Rotation = 90;
        //Adds image to the paragraph 
        paragraph.Items.Add(picture);
        //Saves the Word document  
        document.Save("Sample.docx", FormatType.Docx);
        //Closes the document  
        document.Close();
        'Creates a New Word document 
        Dim document As WordDocument = New WordDocument
        'Adds new section to the document
        Dim section As IWSection = document.AddSection
        'Adds new text to the paragraph 
        Dim paragraph As IWParagraph = section.AddParagraph
        'Gets the image and convert to byte array   
        Dim image As Image = Image.FromFile("Image.png")
        Dim imageStream As MemoryStream = New MemoryStream
        image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png)
        Dim imageBytes() As Byte = imageStream.ToArray
        'Initializes new picture 
        Dim picture As WPicture = New WPicture(document)
        'Loads an image from the byte array  
        picture.LoadImage(imageBytes)
        'Sets height and width for the image 
        picture.Height = 100
        picture.Width = 150
        'Sets picture rotation in degree  
        picture.Rotation = 90
        'Adds image to the paragraph 
        paragraph.Items.Add(picture)
        'Saves the Word document  
        document.Save("Sample.docx", FormatType.Docx)
        'Closes the document  
        document.Close()

    SvgData

    Gets the SVG image as byte array. Read-only.

    Declaration
    public byte[] SvgData { get; }
    Property Value
    Type Description
    System.Byte[]

    The System.Byte array that represents SVG image bytes.

    TextWrappingStyle

    Gets or sets the text wrapping style of the picture.

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

    The TextWrappingStyle member that specifies the text wrapping style.

    TextWrappingType

    Gets or sets the text wrapping type of the picture.

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

    The TextWrappingType member that specifies the text wrapping type.

    Title

    Gets or sets the picture title.

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

    The string that represents the title.

    VerticalAlignment

    Gets or sets the vertical alignment of the picture.

    Declaration
    public ShapeVerticalAlignment VerticalAlignment { get; set; }
    Property Value
    Type
    ShapeVerticalAlignment
    Remarks

    If the alignment is set as None, then the picture is explicitly positioned using position properties. Otherwise it is positioned according to the alignment specified. The position of the object is relative to VerticalOrigin.

    VerticalOrigin

    Gets or sets the vertical origin of the picture.

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

    The VerticalOrigin member that specifies the vertical origin.

    VerticalPosition

    Gets or sets absolute vertical position of the picture in points.

    Declaration
    public float VerticalPosition { get; set; }
    Property Value
    Type Description
    System.Single

    The float that specifies the vertical position.

    Remarks

    The vertical position is relative to the VerticalOrigin.

    Visible

    Gets or sets a value indicating whether the picture is visible.

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

    True if the picture is visible; otherwise, false.

    Width

    Gets or sets the picture width in points.

    Declaration
    public float Width { get; set; }
    Property Value
    Type Description
    System.Single

    The float that specifies the width.

    WidthScale

    Gets or sets the picture width scale factor in percent.

    Declaration
    public float WidthScale { get; set; }
    Property Value
    Type Description
    System.Single

    The float that specifies the width scale factor.

    Methods

    AddCaption(String, CaptionNumberingFormat, CaptionPosition)

    Adds caption for the current picture with specified name, caption format and caption position.

    Declaration
    public IWParagraph AddCaption(string name, CaptionNumberingFormat format, CaptionPosition captionPosition)
    Parameters
    Type Name Description
    System.String name

    The string that specifies the name.

    CaptionNumberingFormat format

    The CaptionNumberingFormat member that specifies the format for caption numbering.

    CaptionPosition captionPosition

    The CaptionPosition member that specifies the position of caption.

    Returns
    Type Description
    IWParagraph

    The paragraph instance with the specified caption.

    Examples
    private void Button1_Click(System.Object sender, System.EventArgs e)
    {
        //Create a new Word document 
        WordDocument document = new WordDocument();
        //Add new section to the document
        IWSection section = document.AddSection();
        //Add new paragraph to the section
        IWParagraph paragraph = section.AddParagraph();
        paragraph.AppendText("This paragraph has picture. ");
        //Append new picture to the paragraph
        IWPicture picture = paragraph.AppendPicture(Image.FromFile("Image.png"));            
        //Set width and height for the paragraph
        picture.Width = 150;
        picture.Height = 100;            
        //Set caption for picture
        picture.AddCaption("Figure 1.1", CaptionNumberingFormat.Number, CaptionPosition.AboveImage);
        //Save the Word document
        document.Save("Sample.docx", FormatType.Docx);
        //Close the document
        document.Close();
    }
    Private Sub button_Click(sender As Object, e As EventArgs)
        'Create a new Word document 
        Dim document As New WordDocument()
        'Add new section to the document
        Dim section As IWSection = document.AddSection()
        'Add new paragraph to the section
        Dim paragraph As IWParagraph = section.AddParagraph()
        paragraph.AppendText("This paragraph has picture. ")
        'Append new picture to the paragraph
        Dim picture As IWPicture = paragraph.AppendPicture(Image.FromFile("Image.png"))
        'Set width and height for the paragraph
        picture.Width = 150
        picture.Height = 100
        'Set caption for picture
        picture.AddCaption("Figure 1.1", CaptionNumberingFormat.Number, CaptionPosition.AboveImage)
        'Save the Word document
        document.Save("Sample.docx", FormatType.Docx)
        'Close the document
        document.Close()
    End Sub

    CloneImpl()

    Creates a duplicate copy of the entity.

    Declaration
    protected override object CloneImpl()
    Returns
    Type Description
    System.Object

    An System.Object reference to the newly created instance.

    Overrides
    ParagraphItem.CloneImpl()

    CreateLayoutInfo()

    Creates layout information.

    Declaration
    protected override void CreateLayoutInfo()
    Overrides
    WidgetBase.CreateLayoutInfo()

    InitXDLSHolder()

    Registers child objects in XDSL holder.

    Declaration
    protected override void InitXDLSHolder()
    Overrides
    XDLSSerializableBase.InitXDLSHolder()

    LoadImage(Byte[])

    Loads the image from the specified byte array.

    Declaration
    public void LoadImage(byte[] imageBytes)
    Parameters
    Type Name Description
    System.Byte[] imageBytes

    The byte array that specifies the image as bytes.

    Examples
    private void Button1_Click(System.Object sender, System.EventArgs e)
    {
        //Create a new Word document 
        WordDocument document = new WordDocument();
        //Add new section to the document
        IWSection section = document.AddSection();
        //Add new paragraph to the section
        IWParagraph paragraph = section.AddParagraph();
        //Get the image and convert to byte array
        Image image = Image.FromFile("Image.png");
        MemoryStream imageStream = new MemoryStream();
        image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png);
        byte[] imageBytes = imageStream.ToArray();
        //Initialize new picture
        WPicture picture = new WPicture(document);
        //Load image from the byte array
        picture.LoadImage(imageBytes);
        //Set width and height
        picture.Height = 100;
        picture.Width = 150;
        //Add picture to the paragraph
        paragraph.Items.Add(picture);
        //Save and close the document
        document.Save("Sample.docx", FormatType.Docx);
        document.Close();
    }
    Private Sub button_Click(sender As Object, e As EventArgs)
        'Create a new Word document 
        Dim document As New WordDocument()
        'Add new section to the document
        Dim section As IWSection = document.AddSection()
        'Add new paragraph to the section
        Dim paragraph As IWParagraph = section.AddParagraph()
        'Get the image and convert to byte array
        Dim image__1 As Image = Image.FromFile("Image.png")
        Dim imageStream As New MemoryStream()
        image__1.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png)
        Dim imageBytes As Byte() = imageStream.ToArray()
        'Initialize new picture
        Dim picture As New WPicture(document)
        'Load image from the byte array
        picture.LoadImage(imageBytes)
        'Set width and height
        picture.Height = 100
        picture.Width = 150
        'Add picture to the paragraph
        paragraph.Items.Add(picture)
        'Save and close the document
        document.Save("Sample.docx", FormatType.Docx)
        document.Close()
    End Sub

    LoadImage(Byte[], Byte[])

    Loads the SVG image from the specified byte array.

    Declaration
    public void LoadImage(byte[] svgData, byte[] imageBytes)
    Parameters
    Type Name Description
    System.Byte[] svgData

    The byte array that specifies the SVG image as bytes.

    System.Byte[] imageBytes

    The byte array that specifies the image as bytes.

    Examples
        //Create a new Word document 
        WordDocument document = new WordDocument();
        //Add new section to the document
        IWSection section = document.AddSection();
        //Add new paragraph to the section
        IWParagraph paragraph = section.AddParagraph();
        //Get the SVG image as byte array.
        byte[] imageBytes = File.ReadAllBytes("Image.png");
        //Get the SVG image as byte array.
        byte[] svgData = File.ReadAllBytes("Image.svg");
        //Initialize new picture
        WPicture picture = new WPicture(document);
        //Load both fallback and SVG image from the byte array
        picture.LoadImage(svgData, imageBytes);
        //Set width and height
        picture.Height = 100;
        picture.Width = 150;
        //Add picture to the paragraph
        paragraph.Items.Add(picture);
        //Save and close the document
        document.Save("Sample.docx", FormatType.Docx);
        document.Close();
    }
        'Create a new Word document 
        Dim document As New WordDocument()
        'Add new section to the document
        Dim section As IWSection = document.AddSection()
        'Add new paragraph to the section
        Dim paragraph As IWParagraph = section.AddParagraph()
        'Get the image byte array
        Dim imageBytes As Byte() = File.ReadAllBytes("Image.png")
        'Get the SVG image as byte array.
        Dim svgData As Byte() = File.ReadAllBytes("Image.svg")
        'Initialize new picture
        Dim picture As New WPicture(document)
        'Load both fallback and SVG image from the byte array
        picture.LoadImage(svgData, imageBytes)
        'Set width and height
        picture.Height = 100
        picture.Width = 150
        'Add picture to the paragraph
        paragraph.Items.Add(picture)
        'Save and close the document
        document.Save("Sample.docx", FormatType.Docx)
        document.Close()
    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown when svgData is null

    System.ArgumentException

    Thrown when svgData is not a *svg format

    LoadImage(Stream)

    Loads the image from the specified stream.

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

    The stream that represents the image.

    ReadXmlAttributes(IXDLSAttributeReader)

    Reads object data from xml attributes.

    Declaration
    protected override void ReadXmlAttributes(IXDLSAttributeReader reader)
    Parameters
    Type Name Description
    IXDLSAttributeReader reader

    The IXDLSAttributeReader object.

    Overrides
    XDLSSerializableBase.ReadXmlAttributes(IXDLSAttributeReader)

    ReadXmlContent(IXDLSContentReader)

    Reads object data from xml attributes.

    Declaration
    protected override bool ReadXmlContent(IXDLSContentReader reader)
    Parameters
    Type Name Description
    IXDLSContentReader reader

    The IXDLSContentReader object.

    Returns
    Type Description
    System.Boolean

    The value indicating the presence of xml content.

    Overrides
    XDLSSerializableBase.ReadXmlContent(IXDLSContentReader)

    WriteXmlAttributes(IXDLSAttributeWriter)

    Writes object data as xml attributes.

    Declaration
    protected override void WriteXmlAttributes(IXDLSAttributeWriter writer)
    Parameters
    Type Name Description
    IXDLSAttributeWriter writer

    The IXDLSAttributeWriter object.

    Overrides
    XDLSSerializableBase.WriteXmlAttributes(IXDLSAttributeWriter)

    WriteXmlContent(IXDLSContentWriter)

    Writes object data as inside xml element.

    Declaration
    protected override void WriteXmlContent(IXDLSContentWriter writer)
    Parameters
    Type Name Description
    IXDLSContentWriter writer

    The IXDLSContentWriter object.

    Overrides
    XDLSSerializableBase.WriteXmlContent(IXDLSContentWriter)

    Implements

    IXDLSSerializable
    IOfficeRun
    IWPicture
    IParagraphItem
    IEntity
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved