WrappingStyle Enumeration |
Specifies how text is wrapped around a shape or picture.
Namespace: SautinSoft.Document.DrawingAssembly: SautinSoft.Document (in SautinSoft.Document.dll) Version: 2025.2.13
Syntaxpublic enum WrappingStyle
Public Enumeration WrappingStyle
MembersMember name | Value | Description |
---|
Square | 0 |
Wraps text around all sides of the square bounding box of the shape.
|
Tight | 1 |
Wraps tightly around the edges of the shape, instead of wrapping around the bounding box.
|
Through | 2 |
Same as Tight, but wraps inside any parts of the shape that are open.
|
TopAndBottom | 3 |
The text stops at the top of the shape and restarts on the line below the shape.
|
BehindText | 4 |
No text wrapping around the shape. The shape is placed behind of text.
|
InFrontOfText | 5 |
No text wrapping around the shape. The shape is placed in front of text.
|
ExampleSee Developer Guide: Creates a new document with shape containing a text and picture
Creates a new document with shape containing a text and picture using C#
using SautinSoft.Document;
using SautinSoft.Document.Drawing;
namespace Example
{
class Program
{
static void Main(string[] args)
{
PictureAndShape();
}
static void PictureAndShape()
{
string filePath = @"Shape.docx";
string imagePath = @"..\..\..\image.jpg";
DocumentCore dc = new DocumentCore();
Shape shapeWithText = new Shape(dc, Layout.Floating(new HorizontalPosition(1, LengthUnit.Inch, HorizontalPositionAnchor.Page),
new VerticalPosition(2, LengthUnit.Inch, VerticalPositionAnchor.Page),
new Size(LengthUnitConverter.Convert(6, LengthUnit.Inch, LengthUnit.Point), LengthUnitConverter.Convert(1.5d, LengthUnit.Centimeter, LengthUnit.Point))));
(shapeWithText.Layout as FloatingLayout).WrappingStyle = WrappingStyle.InFrontOfText;
shapeWithText.Text.Blocks.Add(new Paragraph(dc, new Run(dc, "This is the text in shape.", new CharacterFormat() { Size = 30})));
shapeWithText.Outline.Fill.SetEmpty();
shapeWithText.Fill.SetSolid(Color.Orange);
dc.Content.End.Insert(shapeWithText.Content);
Picture pic = new Picture(dc, imagePath);
pic.Layout = FloatingLayout.Floating(
new HorizontalPosition(50, LengthUnit.Millimeter, HorizontalPositionAnchor.Page),
new VerticalPosition(20, LengthUnit.Millimeter, VerticalPositionAnchor.TopMargin),
new Size(LengthUnitConverter.Convert(10, LengthUnit.Centimeter, LengthUnit.Point),
LengthUnitConverter.Convert(10, LengthUnit.Centimeter, LengthUnit.Point))
);
(pic.Layout as FloatingLayout).WrappingStyle = WrappingStyle.BehindText;
dc.Content.End.Insert(pic.Content);
dc.Save(filePath);
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(filePath) { UseShellExecute = true });
}
}
}
Creates a new document with shape containing a text and picture using VB.Net
Imports System
Imports System.IO
Imports SautinSoft.Document
Imports SautinSoft.Document.Drawing
Module Sample
Sub Main()
PictureAndShape()
End Sub
Sub PictureAndShape()
Dim filePath As String = "Shape.docx"
Dim imagePath As String = "..\..\..\image.jpg"
Dim dc As New DocumentCore()
Dim shapeWithText As New Shape(dc, Layout.Floating(New HorizontalPosition(1, LengthUnit.Inch, HorizontalPositionAnchor.Page), New VerticalPosition(2, LengthUnit.Inch, VerticalPositionAnchor.Page), New Size(LengthUnitConverter.Convert(6, LengthUnit.Inch, LengthUnit.Point), LengthUnitConverter.Convert(1.5R, LengthUnit.Centimeter, LengthUnit.Point))))
TryCast(shapeWithText.Layout, FloatingLayout).WrappingStyle = WrappingStyle.InFrontOfText
shapeWithText.Text.Blocks.Add(New Paragraph(dc, New Run(dc, "This is the text in shape.", New CharacterFormat() With {.Size = 30})))
shapeWithText.Outline.Fill.SetEmpty()
shapeWithText.Fill.SetSolid(Color.Orange)
dc.Content.End.Insert(shapeWithText.Content)
Dim pic As New Picture(dc, imagePath)
pic.Layout = FloatingLayout.Floating(New HorizontalPosition(50, LengthUnit.Millimeter, HorizontalPositionAnchor.Page), New VerticalPosition(20, LengthUnit.Millimeter, VerticalPositionAnchor.TopMargin), New Size(LengthUnitConverter.Convert(10, LengthUnit.Centimeter, LengthUnit.Point), LengthUnitConverter.Convert(10, LengthUnit.Centimeter, LengthUnit.Point)))
TryCast(pic.Layout, FloatingLayout).WrappingStyle = WrappingStyle.BehindText
dc.Content.End.Insert(pic.Content)
dc.Save(filePath)
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(filePath) With {.UseShellExecute = True})
End Sub
End Module
See Also