com.aspose.words
Class WrapType

java.lang.Object
    extended by 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 in the middle of a page.
// This creates a builder and also an empty document inside the builder.
DocumentBuilder builder = new DocumentBuilder();

// By default, the image is inline.
Shape shape = builder.insertImage(getMyDir() + "Aspose.Words.gif");

// Make the image float, put it behind text and center on the page.
shape.setWrapType(WrapType.NONE);
shape.setBehindText(true);
shape.setRelativeHorizontalPosition(RelativeHorizontalPosition.PAGE);
shape.setHorizontalAlignment(HorizontalAlignment.CENTER);
shape.setRelativeVerticalPosition(RelativeVerticalPosition.PAGE);
shape.setVerticalAlignment(VerticalAlignment.CENTER);

builder.getDocument().save(getMyDir() + "Image.CreateFloatingPageCenter Out.doc");

Example:

Inserts a watermark image into a document using DocumentBuilder.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// The best place for the watermark image is in the header or footer so it is shown on every page.
builder.moveToHeaderFooter(HeaderFooterType.HEADER_PRIMARY);

// Insert a floating picture.
BufferedImage image =
        javax.imageio.ImageIO.read(new File(getMyDir() + "Watermark.png"));

Shape shape = builder.insertImage(image);
shape.setWrapType(WrapType.NONE);
shape.setBehindText(true);

shape.setRelativeHorizontalPosition(RelativeHorizontalPosition.PAGE);
shape.setRelativeVerticalPosition(RelativeVerticalPosition.PAGE);

// Calculate image left and top position so it appears in the centre of the page.
shape.setLeft((builder.getPageSetup().getPageWidth() - shape.getWidth()) / 2);
shape.setTop((builder.getPageSetup().getPageHeight() - shape.getHeight()) / 2);

doc.save(getMyDir() + "DocumentBuilder.InsertWatermark Out.doc");
See Also:
ShapeBase.WrapType

Field Summary
static final intNONE
           No text wrapping around the shape. The shape is placed behind or in front of text.
static final intINLINE
           The shape remains on the same layer as text and treated as a character.
static final intTOP_BOTTOM
           The text stops at the top of the shape and restarts on the line below the shape.
static final intSQUARE
           Wraps text around all sides of the square bounding box of the shape.
static final intTIGHT
           Wraps tightly around the edges of the shape, instead of wrapping around the bounding box.
static final intTHROUGH
           Same as Tight, but wraps inside any parts of the shape that are open.
 

Field Detail

NONE

public static final int NONE
No text wrapping around the shape. The shape is placed behind or in front of text.

INLINE

public static final int INLINE
The shape remains on the same layer as text and treated as a character.

TOP_BOTTOM

public static final int TOP_BOTTOM
The text stops at the top of the shape and restarts on the line below the shape.

SQUARE

public static final int SQUARE
Wraps text around all sides of the square bounding box of the shape.

TIGHT

public static final int TIGHT
Wraps tightly around the edges of the shape, instead of wrapping around the bounding box.

THROUGH

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.