public class WrapType
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");
Shows how to insert an image, and use it as a watermark.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert the image into the header so that it will be visible on every page.
builder.moveToHeaderFooter(HeaderFooterType.HEADER_PRIMARY);
Shape shape = builder.insertImage(getImageDir() + "Transparent background logo.png");
shape.setWrapType(WrapType.NONE);
shape.setBehindText(true);
// Place the image at the center of the page.
shape.setRelativeHorizontalPosition(RelativeHorizontalPosition.PAGE);
shape.setRelativeVerticalPosition(RelativeVerticalPosition.PAGE);
shape.setLeft((builder.getPageSetup().getPageWidth() - shape.getWidth()) / 2.0);
shape.setTop((builder.getPageSetup().getPageHeight() - shape.getHeight()) / 2.0);
doc.save(getArtifactsDir() + "DocumentBuilder.InsertWatermark.docx");
| Modifier and Type | Field and Description |
|---|---|
static int |
INLINE
The shape remains on the same layer as text and treated as a character.
|
static int |
length |
static int |
NONE
No text wrapping around the shape.
|
static int |
SQUARE
Wraps text around all sides of the square bounding box of the shape.
|
static int |
THROUGH
Same as Tight, but wraps inside any parts of the shape that are open.
|
static int |
TIGHT
Wraps tightly around the edges of the shape, instead of wrapping around the bounding box.
|
static int |
TOP_BOTTOM
The text stops at the top of the shape and restarts on the line below the shape.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
fromName(java.lang.String wrapTypeName) |
static java.lang.String |
getName(int wrapType) |
static int[] |
getValues() |
static java.lang.String |
toString(int wrapType) |
public static int NONE
public static int INLINE
public static int TOP_BOTTOM
public static int SQUARE
public static int TIGHT
public static int THROUGH
public static int length