HorizontalPositionType Enumeration |
Represents a set of possible relative horizontal positions for the parent floating element.
Namespace: SautinSoft.DocumentAssembly: SautinSoft.Document (in SautinSoft.Document.dll) Version: 2025.1.16
Syntax public enum HorizontalPositionType
Public Enumeration HorizontalPositionType
Members Member name | Value | Description |
---|
Absolute | 0 |
Specifies that the parent object should have absolute horizontal positioning
with respect to the anchor settings.
|
Left | 1 |
Specifies that the parent object shall be left aligned with respect to the anchor settings.
|
Center | 2 |
Specifies that the parent object shall be centered with respect to the anchor settings.
|
Right | 3 |
Specifies that the parent object shall be right aligned with respect to the anchor settings.
|
Inside | 4 |
Specifies that the parent object shall be inside of the anchor object.
|
Outside | 5 |
Specifies that the parent object shall be outside of the anchor object.
|
Example See Developer Guide: How to work with shape groups
How to work with shape groups in C#
using SautinSoft.Document;
using SautinSoft.Document.Drawing;
namespace Sample
{
class Sample
{
static void Main(string[] args)
{
ShapeGroups();
}
public static void ShapeGroups()
{
string pictPath = @"..\..\..\image1.jpg";
string documentPath = @"ShapeGroups.docx";
DocumentCore dc = new DocumentCore();
HorizontalPosition hp = new HorizontalPosition(HorizontalPositionType.Center, HorizontalPositionAnchor.Page);
VerticalPosition vp = new VerticalPosition(5f, LengthUnit.Centimeter, VerticalPositionAnchor.TopMargin);
FloatingLayout fl = new FloatingLayout(hp, vp, new Size(300, 300));
ShapeGroup group = new ShapeGroup(dc, fl);
group.ChildSize = new Size(100, 100);
Shape shape1 = new Shape(dc, new GroupLayout(new Point(0, 0), new Size(50, 50)));
shape1.Outline.Fill.SetSolid(new Color("#358CCB"));
shape1.Outline.Width = 2;
shape1.Fill.SetSolid(Color.Orange);
shape1.Geometry.SetPreset(Figure.Rectangle);
Picture picture = new Picture(dc, Layout.Group(new Point(50, 50), new Size(50, 50)), pictPath);
picture.ImageData.FillMode = PictureFillMode.Stretch;
group.ChildShapes.Add(shape1);
group.ChildShapes.Add(picture);
dc.Content.End.Insert(group.Content);
dc.Save(documentPath);
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(documentPath) { UseShellExecute = true });
}
}
}
How to work with shape groups in VB.Net
Imports System
Imports System.IO
Imports SautinSoft.Document
Imports SautinSoft.Document.Drawing
Module Sample
Sub Main()
ShapeGroups()
End Sub
Sub ShapeGroups()
Dim pictPath As String = "..\..\..\image1.jpg"
Dim documentPath As String = "ShapeGroups.docx"
Dim dc As New DocumentCore()
Dim hp As New HorizontalPosition(HorizontalPositionType.Center, HorizontalPositionAnchor.Page)
Dim vp As New VerticalPosition(5.0F, LengthUnit.Centimeter, VerticalPositionAnchor.TopMargin)
Dim fl As New FloatingLayout(hp, vp, New Size(300, 300))
Dim group As New ShapeGroup(dc, fl)
group.ChildSize = New Size(100, 100)
Dim shape1 As New Shape(dc, New GroupLayout(New Point(0, 0), New Size(50, 50)))
shape1.Outline.Fill.SetSolid(New Color("#358CCB"))
shape1.Outline.Width = 2
shape1.Fill.SetSolid(Color.Orange)
shape1.Geometry.SetPreset(Figure.Rectangle)
Dim picture As New Picture(dc, Layout.Group(New Point(50, 50), New Size(50, 50)), pictPath)
picture.ImageData.FillMode = PictureFillMode.Stretch
group.ChildShapes.Add(shape1)
group.ChildShapes.Add(picture)
dc.Content.End.Insert(group.Content)
dc.Save(documentPath)
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(documentPath) With {.UseShellExecute = True})
End Sub
End Module
See Also