Xceed Words for .NET v3.0 Documentation
InsertShape Method
Example 


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.
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();
}
Requirements

Target Platforms: Windows 11, Windows 10, Windows 7, Windows, 11, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Paragraph Class
Paragraph Members