VegaRise.NET
HomeAPI Reference
Back to DOM

PositionClass

Definition

Namespace
DOM.Elements.Graphics
Assembly
DOM.dll

Represents the positioning configuration of a floating document element (such as an image or shape) relative to the page, margins, or text.

Remarks

This class extends and provides a high-level, schema-safe abstraction over WordprocessingML and DrawingML anchor positioning. BasePosition The implementation guarantees that mutually exclusive positioning modes (absolute offset vs. alignment) are always enforced at runtime, preventing the generation of invalid or unsafe XML.

Examples

csharp
1// 1. Absolute positioning using coordinates
2var p = new Position(100, 200, Units.pt);
3
csharp
1// 2. Center an element on the page
2var p = new Position(
3 HorizontalAlignmentValues.Center,
4 VerticalAlignmentValues.center);
5
csharp
1// 3. Center horizontally and place 150pt from the top
2var p = new Position(HorizontalAlignmentValues.Center, 150, Units.pt);
3
csharp
1// 4. Configure mode and anchors on a default position
2var p = new Position
3{
4 HorizontalRelativePosition = HorizontalRelativePositionValues.margin,
5 VerticalRelativePosition = VerticalRelativePositionValues.paragraph,
6 AllowOverlap = true,
7 MoveObjectWithText = true
8};
9

Constructors

Position()

Initializes a new instance using default, Word-compatible positioning values. Position

Position(double x, double y, Units unit)

Initializes a new instance using absolute horizontal and vertical offsets. Position

Position(HorizontalAlignmentValues horizontalAlignment, VerticalAlignmentValues verticalAlignment)

Initializes a new instance using alignment-based positioning relative to the page. Position

Position(HorizontalAlignmentValues horizontalAlignment, double y, Units unit)

Initializes a new instance using mixed positioning, with horizontal alignment and vertical absolute offset. Position

Properties

AllowOverlap

Gets or sets a value indicating whether the element is allowed to overlap other floating elements.

HorizontalAlignment

Gets or sets the horizontal alignment of the element within its . HorizontalRelativePosition

Setting this property switches the horizontal positioning mode to alignment-based positioning and clears any absolute offset.

HorizontalIsAbsoluteBasePosition

Gets or sets a value indicating whether the horizontal position is specified as an absolute offset.

When set to, horizontal alignment is cleared and the horizontal offset defined in is used. true BasePosition

HorizontalRelativePositionHorizontalRelativePositionValues

Gets or sets the reference frame used for horizontal positioning (for example, page, margin, or column).

LockAnchor

Gets or sets a value indicating whether the anchor point of the element is locked to prevent repositioning.

MoveObjectWithText

Gets or sets a value indicating whether the element moves together with the associated text when the document content changes.

VerticalAlignment

Gets or sets the vertical alignment of the element within its . VerticalRelativePosition

Setting this property switches the vertical positioning mode to alignment-based positioning and clears any absolute offset.

VerticalIsAbsoluteBasePosition

Gets or sets a value indicating whether the vertical position is specified as an absolute offset.

When set to, vertical alignment is cleared and the vertical offset defined in is used. true BasePosition

VerticalRelativePosition

Gets or sets the reference frame used for vertical positioning (for example, page, margin, paragraph, or line).