Xceed Words for .NET v5.2 Documentation
Xceed.Document.NET Assembly / Xceed.Document.NET Namespace / Paragraph Class / InsertShape Method
The Shape to insert.
The index at which to insert the shape. By default, 0.
Example


In This Topic
    InsertShape Method
    In This Topic
    Inserts a Shape at a specific location in this Paragraph.
    Syntax
    'Declaration
     
    
    Public Function InsertShape( _
       ByVal s As Shape, _
       Optional ByVal index As Integer _
    ) As Paragraph
    'Usage
     
    
    Dim instance As Paragraph
    Dim s As Shape
    Dim index As Integer
    Dim value As Paragraph
     
    value = instance.InsertShape(s, index)
    public Paragraph InsertShape( 
       Shape s,
       int index
    )

    Parameters

    s
    The Shape to insert.
    index
    The index at which to insert the shape. By default, 0.

    Return Value

    This Paragraph with the Shape inserted.
    Example
    // Create a document.
    using (var document = DocX.Create("Test.docx"))
    {
      // Create a shape and add it to the document.
      var shape = document.AddShape( 50, 50 );
      shape.OutlineColor = Color.Green;
    
      // Create a paragraph and insert the shape at its 16th character.
      var p = document.InsertParagraph( "Here is a simple default rectangle positioned on the 16th character of this paragraph." );
      p.InsertShape( shape, 16 );
      p.SpacingAfter( 30 );
    
      // Save all changes made to this document.
      document.Save();
    }
    Supported Frameworks

    .NET: net5.0, net5.0-windows, net6.0, net6.0-macos, net6.0-windows, net7.0, net7.0-macos, net7.0-windows, net8.0, net8.0-browser, net8.0-macos, net8.0-windows, net9.0, net9.0-browser, net9.0-macos, net9.0-windows, net10.0, net10.0-browser, net10.0-macos, net10.0-windows.

    .NET Framework: net40, net403, net45, net451, net452, net46, net461, net462, net463, net47, net471, net472, net48, net481.

    See Also