HorizontalAlignment

Inheritance: java.lang.Object

public class HorizontalAlignment

Specifies horizontal alignment of a floating shape, text frame or floating table.

Examples:

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


 Document doc = new Document();
 DocumentBuilder builder = new DocumentBuilder(doc);

 // Insert a floating image that will appear behind the overlapping text and align it to the page's center.
 Shape shape = builder.insertImage(getImageDir() + "Logo.jpg");
 shape.setWrapType(WrapType.NONE);
 shape.setBehindText(true);
 shape.setRelativeHorizontalPosition(RelativeHorizontalPosition.PAGE);
 shape.setRelativeVerticalPosition(RelativeVerticalPosition.PAGE);
 shape.setHorizontalAlignment(HorizontalAlignment.CENTER);
 shape.setVerticalAlignment(VerticalAlignment.CENTER);

 doc.save(getArtifactsDir() + "Image.CreateFloatingPageCenter.docx");
 

Fields

FieldDescription
CENTERSpecifies that the object shall be centered with respect to the horizontal alignment base.
DEFAULTSame as NONE.
INSIDESpecifies that the object shall be inside of the horizontal alignment base.
LEFTSpecifies that the object shall be left aligned to the horizontal alignment base.
NONEThe object is explicitly positioned, usually using its Left property.
OUTSIDESpecifies that the object shall be outside of the horizontal alignment base.
RIGHTSpecifies that the object shall be right aligned to the horizontal alignment base.
length

Methods

MethodDescription
fromName(String horizontalAlignmentName)
getName(int horizontalAlignment)
getValues()
toString(int horizontalAlignment)

CENTER

public static int CENTER

Specifies that the object shall be centered with respect to the horizontal alignment base.

DEFAULT

public static int DEFAULT

Same as NONE.

INSIDE

public static int INSIDE

Specifies that the object shall be inside of the horizontal alignment base.

LEFT

public static int LEFT

Specifies that the object shall be left aligned to the horizontal alignment base.

NONE

public static int NONE

The object is explicitly positioned, usually using its Left property.

OUTSIDE

public static int OUTSIDE

Specifies that the object shall be outside of the horizontal alignment base.

public static int RIGHT

Specifies that the object shall be right aligned to the horizontal alignment base.

length

public static int length

fromName(String horizontalAlignmentName)

public static int fromName(String horizontalAlignmentName)

Parameters:

ParameterTypeDescription
horizontalAlignmentNamejava.lang.String

Returns: int

getName(int horizontalAlignment)

public static String getName(int horizontalAlignment)

Parameters:

ParameterTypeDescription
horizontalAlignmentint

Returns: java.lang.String

getValues()

public static int[] getValues()

Returns: int[]

toString(int horizontalAlignment)

public static String toString(int horizontalAlignment)

Parameters:

ParameterTypeDescription
horizontalAlignmentint

Returns: java.lang.String