Back to Devexpress

Shape.MarginRight Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-shape-ae1a50dd.md

latest3.5 KB
Original Source

Shape.MarginRight Property

Gets or sets the distance between the document text and the right edge of the shape.

Namespace : DevExpress.XtraRichEdit.API.Native

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
float MarginRight { get; set; }
vb
Property MarginRight As Single

Property Value

TypeDescription
Single

The distance in measurement units specified by the Document.Unit property.

|

Remarks

The MarginRight property is not in effect for shapes positioned behind text , in front of text , or with the top and bottom wrap type. Use the Shape.TextWrapping property to change the text wrap type.

The example below demonstrates how to wrap text around a shape.

csharp
Document document = wordProcessor.Document;
document.LoadDocument("FirstLook.docx");
// Set the measurement unit to inches.
document.Unit = DevExpress.Office.DocumentUnit.Inch;

// Create a rectangle with a folded corner.
Shape rectangle = document.Shapes.InsertShape(document.CreatePosition(100), ShapeGeometryPreset.FoldedCorner);
// Center the rectangle on the page.
rectangle.RelativeHorizontalPosition = ShapeRelativeHorizontalPosition.Page;
rectangle.HorizontalAlignment = ShapeHorizontalAlignment.Center;
rectangle.RelativeVerticalPosition = ShapeRelativeVerticalPosition.Page;
rectangle.VerticalAlignment = ShapeVerticalAlignment.Center;

// Wrap text around the rectangle.
rectangle.TextWrapping = TextWrappingType.Square;

// Set the distance between the rectangle and text.
rectangle.MarginTop = 0.1f;
rectangle.MarginBottom = 0.1f;
rectangle.MarginLeft = 0.2f;
rectangle.MarginRight = 0.2f;
vb
Dim document As Document = wordProcessor.Document
document.LoadDocument("FirstLook.docx")
' Set the measurement unit to inches.
document.Unit = DevExpress.Office.DocumentUnit.Inch

' Create a rectangle with a folded corner.
Dim rectangle As Shape = document.Shapes.InsertShape(document.CreatePosition(100), ShapeGeometryPreset.FoldedCorner)
' Center the rectangle on the page.
rectangle.RelativeHorizontalPosition = ShapeRelativeHorizontalPosition.Page
rectangle.HorizontalAlignment = ShapeHorizontalAlignment.Center
rectangle.RelativeVerticalPosition = ShapeRelativeVerticalPosition.Page
rectangle.VerticalAlignment = ShapeVerticalAlignment.Center

' Wrap text around the rectangle.
rectangle.TextWrapping = TextWrappingType.Square

' Set the distance between the rectangle and text.
rectangle.MarginTop = 0.1F
rectangle.MarginBottom = 0.1F
rectangle.MarginLeft = 0.2F
rectangle.MarginRight = 0.2F

See Also

Shape Interface

Shape Members

DevExpress.XtraRichEdit.API.Native Namespace