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.
TOP_MARGINSpecifies that the vertical positioning shall be relative to the top margin of the current page.
BOTTOM_MARGINSpecifies that the vertical positioning shall be relative to the bottom margin of the current page.
INSIDE_MARGINSpecifies that the vertical positioning shall be relative to the inside margin of the current page.
OUTSIDE_MARGINSpecifies that the vertical positioning shall be relative to the outside margin of the current page.
TABLE_DEFAULTDefault value is RelativeVerticalPosition.MARGIN.
TEXT_FRAME_DEFAULTDefault value is RelativeVerticalPosition.PARAGRAPH.

Examples

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

doc = aw.Document()
builder = aw.DocumentBuilder(doc)

# Insert the image into the header so that it will be visible on every page.
image = drawing.Image.from_file(IMAGE_DIR + "Transparent background logo.png")
builder.move_to_header_footer(aw.HeaderFooterType.HEADER_PRIMARY)
shape = builder.insert_image(image)
shape.wrap_type = aw.drawing.WrapType.NONE
shape.behind_text = True

# Place the image at the center of the page.
shape.relative_horizontal_position = aw.drawing.RelativeHorizontalPosition.PAGE
shape.relative_vertical_position = aw.drawing.RelativeVerticalPosition.PAGE
shape.left = (builder.page_setup.page_width - shape.width) // 2
shape.top = (builder.page_setup.page_height - shape.height) // 2

doc.save(ARTIFACTS_DIR + "DocumentBuilder.insert_watermark.docx")

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

doc = aw.Document()
builder = aw.DocumentBuilder(doc)

# Insert a floating image that will appear behind the overlapping text and align it to the page's center.
shape = builder.insert_image(IMAGE_DIR + "Logo.jpg")
shape.wrap_type = aw.drawing.WrapType.NONE
shape.behind_text = True
shape.relative_horizontal_position = aw.drawing.RelativeHorizontalPosition.PAGE
shape.relative_vertical_position = aw.drawing.RelativeVerticalPosition.PAGE
shape.horizontal_alignment = aw.drawing.HorizontalAlignment.CENTER
shape.vertical_alignment = aw.drawing.VerticalAlignment.CENTER

doc.save(ARTIFACTS_DIR + "Image.create_floating_page_center.docx")

See Also