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