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
Field | Description |
---|---|
CENTER | Specifies that the object shall be centered with respect to the horizontal alignment base. |
DEFAULT | Same as NONE. |
INSIDE | Specifies that the object shall be inside of the horizontal alignment base. |
LEFT | Specifies that the object shall be left aligned to the horizontal alignment base. |
NONE | The object is explicitly positioned, usually using its Left property. |
OUTSIDE | Specifies that the object shall be outside of the horizontal alignment base. |
RIGHT | Specifies that the object shall be right aligned to the horizontal alignment base. |
length |
Methods
Method | Description |
---|---|
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.
RIGHT
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:
Parameter | Type | Description |
---|---|---|
horizontalAlignmentName | java.lang.String |
Returns: int
getName(int horizontalAlignment)
public static String getName(int horizontalAlignment)
Parameters:
Parameter | Type | Description |
---|---|---|
horizontalAlignment | int |
Returns: java.lang.String
getValues()
public static int[] getValues()
Returns: int[]
toString(int horizontalAlignment)
public static String toString(int horizontalAlignment)
Parameters:
Parameter | Type | Description |
---|---|---|
horizontalAlignment | int |
Returns: java.lang.String