java.lang.Object
com.aspose.words.WrapType
public class WrapType
- extends java.lang.Object
Utility class containing constants.
Specifies how text is wrapped around a shape or picture.
Example:
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");
Example:
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.
BufferedImage image = ImageIO.read(new File(getImageDir() + "Transparent background logo.png"));
builder.moveToHeaderFooter(HeaderFooterType.HEADER_PRIMARY);
Shape shape = builder.insertImage(image);
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");
- See Also:
- ShapeBase.WrapType
Field Summary |
static final int | NONE = 3 | |
No text wrapping around the shape. The shape is placed behind or in front of text.
|
static final int | INLINE = 0 | |
The shape remains on the same layer as text and treated as a character.
|
static final int | TOP_BOTTOM = 1 | |
The text stops at the top of the shape and restarts on the line below the shape.
|
static final int | SQUARE = 2 | |
Wraps text around all sides of the square bounding box of the shape.
|
static final int | TIGHT = 4 | |
Wraps tightly around the edges of the shape, instead of wrapping around the bounding box.
|
static final int | THROUGH = 5 | |
Same as Tight, but wraps inside any parts of the shape that are open.
|
NONE = 3 | |
public static final int NONE |
-
No text wrapping around the shape. The shape is placed behind or in front of text.
INLINE = 0 | |
public static final int INLINE |
-
The shape remains on the same layer as text and treated as a character.
TOP_BOTTOM = 1 | |
public static final int TOP_BOTTOM |
-
The text stops at the top of the shape and restarts on the line below the shape.
SQUARE = 2 | |
public static final int SQUARE |
-
Wraps text around all sides of the square bounding box of the shape.
TIGHT = 4 | |
public static final int TIGHT |
-
Wraps tightly around the edges of the shape, instead of wrapping around the bounding box.
THROUGH = 5 | |
public static final int THROUGH |
-
Same as Tight, but wraps inside any parts of the shape that are open.
See Also:
Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
Aspose.Words Support Forum - our preferred method of support.