com.aspose.words
Class RelativeVerticalSize

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

public class RelativeVerticalSize 
extends java.lang.Object

Utility class containing constants. Specifies relatively to what the height of a shape or a text frame is calculated vertically.

Example:

Shows how to set relative size and position.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Adding a simple shape with absolute size and position.
Shape shape = builder.insertShape(ShapeType.RECTANGLE, 100.0, 40.0);
// Set WrapType to WrapType.None since Inline shapes are automatically converted to absolute units.
shape.setWrapType(WrapType.NONE);

// Checking and setting the relative horizontal size.
if (shape.getRelativeHorizontalSize() == RelativeHorizontalSize.DEFAULT)
{
    // Setting the horizontal size binding to Margin.
    shape.setRelativeHorizontalSize(RelativeHorizontalSize.MARGIN);
    // Setting the width to 50% of Margin width.
    shape.setWidthRelative(50f);
}

// Checking and setting the relative vertical size.
if (shape.getRelativeVerticalSize() == RelativeVerticalSize.DEFAULT)
{
    // Setting the vertical size binding to Margin.
    shape.setRelativeVerticalSize(RelativeVerticalSize.MARGIN);
    // Setting the heigh to 30% of Margin height.
    shape.setHeightRelative(30f);
}

// Checking and setting the relative vertical position.
if (shape.getRelativeVerticalPosition() == RelativeVerticalPosition.PARAGRAPH)
{
    // etting the position binding to TopMargin.
    shape.setRelativeVerticalPosition(RelativeVerticalPosition.TOP_MARGIN);
    // Setting relative Top to 30% of TopMargin position.
    shape.setTopRelative(30f);
}

// Checking and setting the relative horizontal position.
if (shape.getRelativeHorizontalPosition() == RelativeHorizontalPosition.DEFAULT)
{
    // Setting the position binding to RightMargin.
    shape.setRelativeHorizontalPosition(RelativeHorizontalPosition.RIGHT_MARGIN);
    // The position relative value can be negative.
    shape.setLeftRelative(-260);
}

doc.save(getArtifactsDir() + "Shape.RelativeSizeAndPosition.docx");
See Also:
ShapeBase.RelativeVerticalSize

Field Summary
static final intMARGIN = 0
           Specifies that the height is calculated relatively to the space between the top and the bottom margins.
static final intPAGE = 1
           Specifies that the height is calculated relatively to the page height.
static final intTOP_MARGIN = 2
           Specifies that the height is calculated relatively to the top margin area size.
static final intBOTTOM_MARGIN = 3
           Specifies that the height is calculated relatively to the bottom margin area size.
static final intINNER_MARGIN = 4
           Specifies that the height is calculated relatively to the inside margin area size, to the top margin area size for odd pages and to the bottom margin area size for even pages.
static final intOUTER_MARGIN = 5
           Specifies that the height is calculated relatively to the outside margin area size, to the bottom margin area size for odd pages and to the top margin area size for even pages.
static final intDEFAULT = 1
           Default value is MARGIN.
 

Field Detail

MARGIN = 0

public static final int MARGIN
Specifies that the height is calculated relatively to the space between the top and the bottom margins.

PAGE = 1

public static final int PAGE
Specifies that the height is calculated relatively to the page height.

TOP_MARGIN = 2

public static final int TOP_MARGIN
Specifies that the height is calculated relatively to the top margin area size.

BOTTOM_MARGIN = 3

public static final int BOTTOM_MARGIN
Specifies that the height is calculated relatively to the bottom margin area size.

INNER_MARGIN = 4

public static final int INNER_MARGIN
Specifies that the height is calculated relatively to the inside margin area size, to the top margin area size for odd pages and to the bottom margin area size for even pages.

OUTER_MARGIN = 5

public static final int OUTER_MARGIN
Specifies that the height is calculated relatively to the outside margin area size, to the bottom margin area size for odd pages and to the top margin area size for even pages.

DEFAULT = 1

public static final int DEFAULT
Default value is MARGIN.

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