ShapeBaseWrapType Property

Defines whether the shape is inline or floating. For floating shapes defines the wrapping mode for text around the shape.

Namespace:  Aspose.Words.Drawing
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.7.0


public WrapType WrapType { get; set; }

Property Value

Type: WrapType


The default value is None.

Has effect only for top level shapes.


Shows how to insert a floating image in the middle of a page.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// By default, the image is inline
Shape shape = builder.InsertImage(ImageDir + "Logo.jpg");

// Make the image float, put it behind text and center on the page
shape.WrapType = WrapType.None;
shape.BehindText = true;
shape.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
shape.RelativeVerticalPosition = RelativeVerticalPosition.Page;
shape.HorizontalAlignment = HorizontalAlignment.Center;
shape.VerticalAlignment = VerticalAlignment.Center;

doc.Save(ArtifactsDir + "Image.CreateFloatingPageCenter.docx");
Shows how to create a textbox with some text and different formatting options in a new document.
Document doc = new Document();

// Create a new shape of type TextBox
Shape textBox = new Shape(doc, ShapeType.TextBox);

// Set some settings of the textbox itself
// Set the wrap of the textbox to inline
textBox.WrapType = WrapType.None;
// Set the horizontal and vertical alignment of the text inside the shape
textBox.HorizontalAlignment = HorizontalAlignment.Center;
textBox.VerticalAlignment = VerticalAlignment.Top;

// Set the textbox height and width
textBox.Height = 50;
textBox.Width = 200;

// Set the textbox in front of other shapes with a lower ZOrder
textBox.ZOrder = 2;

// Let's create a new paragraph for the textbox manually and align it in the center
// Make sure we add the new nodes to the textbox as well
textBox.AppendChild(new Paragraph(doc));
Paragraph para = textBox.FirstParagraph;
para.ParagraphFormat.Alignment = ParagraphAlignment.Center;

// Add some text to the paragraph
Run run = new Run(doc);
run.Text = "Hello world!";

// Append the textbox to the first paragraph in the body

doc.Save(ArtifactsDir + "Shape.CreateTextBox.docx");

See Also