com.aspose.words
Class RelativeVerticalPosition

java.lang.Object
    extended by com.aspose.words.RelativeVerticalPosition

public class RelativeVerticalPosition 
extends java.lang.Object

Utility class containing constants. Specifies to what the vertical position of a shape or text frame is relative.

Example:

Shows how to insert a floating image in the middle of a page.
// This creates a builder and also an empty document inside the builder.
DocumentBuilder builder = new DocumentBuilder();

// By default, the image is inline.
Shape shape = builder.insertImage(getMyDir() + "Aspose.Words.gif");

// Make the image float, put it behind text and center on the page.
shape.setWrapType(WrapType.NONE);
shape.setBehindText(true);
shape.setRelativeHorizontalPosition(RelativeHorizontalPosition.PAGE);
shape.setHorizontalAlignment(HorizontalAlignment.CENTER);
shape.setRelativeVerticalPosition(RelativeVerticalPosition.PAGE);
shape.setVerticalAlignment(VerticalAlignment.CENTER);

builder.getDocument().save(getMyDir() + "Image.CreateFloatingPageCenter Out.doc");

Example:

Inserts a watermark image into a document using DocumentBuilder.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// The best place for the watermark image is in the header or footer so it is shown on every page.
builder.moveToHeaderFooter(HeaderFooterType.HEADER_PRIMARY);

// Insert a floating picture.
BufferedImage image =
        javax.imageio.ImageIO.read(new File(getMyDir() + "Watermark.png"));

Shape shape = builder.insertImage(image);
shape.setWrapType(WrapType.NONE);
shape.setBehindText(true);

shape.setRelativeHorizontalPosition(RelativeHorizontalPosition.PAGE);
shape.setRelativeVerticalPosition(RelativeVerticalPosition.PAGE);

// Calculate image left and top position so it appears in the centre of the page.
shape.setLeft((builder.getPageSetup().getPageWidth() - shape.getWidth()) / 2);
shape.setTop((builder.getPageSetup().getPageHeight() - shape.getHeight()) / 2);

doc.save(getMyDir() + "DocumentBuilder.InsertWatermark Out.doc");
See Also:
ShapeBase.RelativeVerticalPosition

Field Summary
static final intMARGIN
           Specifies that the vertical positioning shall be relative to the page margins.
static final intPAGE
           The object is positioned relative to the top edge of the page.
static final intPARAGRAPH
           The object is positioned relative to the top of the paragraph that contains the anchor.
static final intLINE
           Undocumented.
static final intINSIDE_MARGIN
           Specifies that the vertical positioning shall be relative to the inside margin of the current page.
static final intOUTSIDE_MARGIN
           Specifies that the vertical positioning shall be relative to the outside margin of the current page.
static final intTOP_MARGIN
           Specifies that the vertical positioning shall be relative to the top margin of the current page.
static final intBOTTOM_MARGIN
           Specifies that the vertical positioning shall be relative to the bottom margin of the current page.
static final intDEFAULT
           Default value is PARAGRAPH.
 

Field Detail

MARGIN

public static final int MARGIN
Specifies that the vertical positioning shall be relative to the page margins.

PAGE

public static final int PAGE
The object is positioned relative to the top edge of the page.

PARAGRAPH

public static final int PARAGRAPH
The object is positioned relative to the top of the paragraph that contains the anchor.

LINE

public static final int LINE
Undocumented.

INSIDE_MARGIN

public static final int INSIDE_MARGIN
Specifies that the vertical positioning shall be relative to the inside margin of the current page.

OUTSIDE_MARGIN

public static final int OUTSIDE_MARGIN
Specifies that the vertical positioning shall be relative to the outside margin of the current page.

TOP_MARGIN

public static final int TOP_MARGIN
Specifies that the vertical positioning shall be relative to the top margin of the current page.

BOTTOM_MARGIN

public static final int BOTTOM_MARGIN
Specifies that the vertical positioning shall be relative to the bottom margin of the current page.

DEFAULT

public static final int DEFAULT
Default value is PARAGRAPH.

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.