public class TextWrapping
Example:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert a table and a paragraph of text after it
Table table = builder.startTable();
builder.insertCell();
builder.write("Cell 1");
builder.insertCell();
builder.write("Cell 2");
builder.endTable();
table.setPreferredWidth(PreferredWidth.fromPoints(300.0));
builder.getFont().setSize(16.0);
builder.writeln("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
// Set the table to wrap text around it and push it down into the paragraph below be setting the position
table.setTextWrapping(TextWrapping.AROUND);
table.setAbsoluteHorizontalDistance(100.0);
table.setAbsoluteVerticalDistance(20.0);
doc.save(getArtifactsDir() + "Table.WrapText.docx");
Field Summary | ||
---|---|---|
static final int | NONE | |
Text and table is displayed in the order of their appearance in the document.
|
||
static final int | AROUND | |
Text is wrapped around the table occupying available side space.
|
||
static final int | DEFAULT | |
Default value.
|