RelativeVerticalPosition enumeration

RelativeVerticalPosition enumeration

Specifies to what the vertical position of a shape or text frame is relative.

Members

NameDescription
MarginSpecifies that the vertical positioning shall be relative to the page margins.
PageThe object is positioned relative to the top edge of the page.
ParagraphThe object is positioned relative to the top of the paragraph that contains the anchor.
LineUndocumented.
TopMarginSpecifies that the vertical positioning shall be relative to the top margin of the current page.
BottomMarginSpecifies that the vertical positioning shall be relative to the bottom margin of the current page.
InsideMarginSpecifies that the vertical positioning shall be relative to the inside margin of the current page.
OutsideMarginSpecifies that the vertical positioning shall be relative to the outside margin of the current page.
TableDefaultDefault value is RelativeVerticalPosition.Margin.
TextFrameDefaultDefault value is RelativeVerticalPosition.Paragraph.

Examples

Shows how to insert a floating image to the center of a page.

let doc = new aw.Document();
let builder = new aw.DocumentBuilder(doc);

// Insert a floating image that will appear behind the overlapping text and align it to the page's center.
let shape = builder.insertImage(base.imageDir + "Logo.jpg");
shape.wrapType = aw.Drawing.WrapType.None;
shape.behindText = true;
shape.relativeHorizontalPosition = aw.Drawing.RelativeHorizontalPosition.Page;
shape.relativeVerticalPosition = aw.Drawing.RelativeVerticalPosition.Page;
shape.horizontalAlignment = aw.Drawing.HorizontalAlignment.Center;
shape.verticalAlignment = aw.Drawing.VerticalAlignment.Center;

doc.save(base.artifactsDir + "Image.CreateFloatingPageCenter.docx");

Shows how to insert an image, and use it as a watermark.

let doc = new aw.Document();
let builder = new aw.DocumentBuilder(doc);

// Insert the image into the header so that it will be visible on every page.
builder.moveToHeaderFooter(aw.HeaderFooterType.HeaderPrimary);
let shape = builder.insertImage(base.imageDir + "Transparent background logo.png");
shape.wrapType = aw.Drawing.WrapType.None;
shape.behindText = true;

// Place the image at the center of the page.
shape.relativeHorizontalPosition = aw.Drawing.RelativeHorizontalPosition.Page;
shape.relativeVerticalPosition = aw.Drawing.RelativeVerticalPosition.Page;
shape.left = (builder.pageSetup.pageWidth - shape.width) / 2;
shape.top = (builder.pageSetup.pageHeight - shape.height) / 2;

doc.save(base.artifactsDir + "DocumentBuilder.InsertWatermark.docx");

See Also