public class TextBox
Use the Example:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert a shape that contains a TextBox
Shape textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 150.0, 100.0);
TextBox textBox = textBoxShape.getTextBox();
// Move the document builder to inside the TextBox and write text
builder.moveTo(textBoxShape.getLastParagraph());
builder.write("Vertical text");
// Text is displayed vertically, written top to bottom
textBox.setLayoutFlow(LayoutFlow.TOP_TO_BOTTOM_IDEOGRAPHIC);
// Move the builder out of the shape and back into the main document body
builder.moveTo(textBoxShape.getParentParagraph());
// Insert another TextBox
textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 150.0, 100.0);
textBox = textBoxShape.getTextBox();
// Apply these values to both these members to get the parent shape to defy the dimensions we set to fit tightly around the TextBox's text
textBox.setFitShapeToText(true);
textBox.setTextBoxWrapMode(TextBoxWrapMode.NONE);
builder.moveTo(textBoxShape.getLastParagraph());
builder.write("Text fit tightly inside textbox");
builder.moveTo(textBoxShape.getParentParagraph());
textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0);
textBox = textBoxShape.getTextBox();
// Set margins for the textbox
textBox.setInternalMarginTop(15.0);
textBox.setInternalMarginBottom(15.0);
textBox.setInternalMarginLeft(15.0);
textBox.setInternalMarginRight(15.0);
builder.moveTo(textBoxShape.getLastParagraph());
builder.write("Text placed according to textbox margins");
doc.save(getArtifactsDir() + "Shape.TextBox.docx");
Property Getters/Setters Summary | ||
---|---|---|
boolean | getFitShapeToText() | |
void | setFitShapeToText(booleanvalue) | |
Determines whether Microsoft Word will grow the shape to fit text. | ||
double | getInternalMarginBottom() | |
void | setInternalMarginBottom(doublevalue) | |
Specifies the inner bottom margin in points for a shape. | ||
double | getInternalMarginLeft() | |
void | setInternalMarginLeft(doublevalue) | |
Specifies the inner left margin in points for a shape. | ||
double | getInternalMarginRight() | |
void | setInternalMarginRight(doublevalue) | |
Specifies the inner right margin in points for a shape. | ||
double | getInternalMarginTop() | |
void | setInternalMarginTop(doublevalue) | |
Specifies the inner top margin in points for a shape. | ||
int | getLayoutFlow() | |
void | setLayoutFlow(intvalue) | |
Determines the flow of the text layout in a shape. The value of the property is LayoutFlow integer constant. | ||
TextBox | getNext() | |
void | ||
Returns or sets a TextBox that represents the next TextBox in a sequence of shapes. | ||
Shape | getParent() | |
Gets a parent shape for the TextBox.
|
||
TextBox | getPrevious() | |
Returns a TextBox that represents the previous TextBox in a sequence of shapes.
|
||
int | getTextBoxWrapMode() | |
void | setTextBoxWrapMode(intvalue) | |
Determines how text wraps inside a shape. The value of the property is TextBoxWrapMode integer constant. | ||
int | getVerticalAnchor() | |
void | setVerticalAnchor(intvalue) | |
Specifies the vertical alignment of the text within a shape. The value of the property is TextBoxAnchor integer constant. |
Method Summary | ||
---|---|---|
void | breakForwardLink() | |
Breaks the link to the next TextBox.
|
||
boolean | isValidLinkTarget(TextBox target) | |
Determines whether this TextBox can be linked to the target Textbox.
|
public boolean getFitShapeToText() / public void setFitShapeToText(boolean value)
The default value is false.
Example:
Shows how to insert text boxes and arrange their text.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Insert a shape that contains a TextBox Shape textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 150.0, 100.0); TextBox textBox = textBoxShape.getTextBox(); // Move the document builder to inside the TextBox and write text builder.moveTo(textBoxShape.getLastParagraph()); builder.write("Vertical text"); // Text is displayed vertically, written top to bottom textBox.setLayoutFlow(LayoutFlow.TOP_TO_BOTTOM_IDEOGRAPHIC); // Move the builder out of the shape and back into the main document body builder.moveTo(textBoxShape.getParentParagraph()); // Insert another TextBox textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 150.0, 100.0); textBox = textBoxShape.getTextBox(); // Apply these values to both these members to get the parent shape to defy the dimensions we set to fit tightly around the TextBox's text textBox.setFitShapeToText(true); textBox.setTextBoxWrapMode(TextBoxWrapMode.NONE); builder.moveTo(textBoxShape.getLastParagraph()); builder.write("Text fit tightly inside textbox"); builder.moveTo(textBoxShape.getParentParagraph()); textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); textBox = textBoxShape.getTextBox(); // Set margins for the textbox textBox.setInternalMarginTop(15.0); textBox.setInternalMarginBottom(15.0); textBox.setInternalMarginLeft(15.0); textBox.setInternalMarginRight(15.0); builder.moveTo(textBoxShape.getLastParagraph()); builder.write("Text placed according to textbox margins"); doc.save(getArtifactsDir() + "Shape.TextBox.docx");
public double getInternalMarginBottom() / public void setInternalMarginBottom(double value)
The default value is 1/20 inch.
Example:
Shows how to insert text boxes and arrange their text.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Insert a shape that contains a TextBox Shape textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 150.0, 100.0); TextBox textBox = textBoxShape.getTextBox(); // Move the document builder to inside the TextBox and write text builder.moveTo(textBoxShape.getLastParagraph()); builder.write("Vertical text"); // Text is displayed vertically, written top to bottom textBox.setLayoutFlow(LayoutFlow.TOP_TO_BOTTOM_IDEOGRAPHIC); // Move the builder out of the shape and back into the main document body builder.moveTo(textBoxShape.getParentParagraph()); // Insert another TextBox textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 150.0, 100.0); textBox = textBoxShape.getTextBox(); // Apply these values to both these members to get the parent shape to defy the dimensions we set to fit tightly around the TextBox's text textBox.setFitShapeToText(true); textBox.setTextBoxWrapMode(TextBoxWrapMode.NONE); builder.moveTo(textBoxShape.getLastParagraph()); builder.write("Text fit tightly inside textbox"); builder.moveTo(textBoxShape.getParentParagraph()); textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); textBox = textBoxShape.getTextBox(); // Set margins for the textbox textBox.setInternalMarginTop(15.0); textBox.setInternalMarginBottom(15.0); textBox.setInternalMarginLeft(15.0); textBox.setInternalMarginRight(15.0); builder.moveTo(textBoxShape.getLastParagraph()); builder.write("Text placed according to textbox margins"); doc.save(getArtifactsDir() + "Shape.TextBox.docx");
public double getInternalMarginLeft() / public void setInternalMarginLeft(double value)
The default value is 1/10 inch.
Example:
Shows how to insert text boxes and arrange their text.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Insert a shape that contains a TextBox Shape textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 150.0, 100.0); TextBox textBox = textBoxShape.getTextBox(); // Move the document builder to inside the TextBox and write text builder.moveTo(textBoxShape.getLastParagraph()); builder.write("Vertical text"); // Text is displayed vertically, written top to bottom textBox.setLayoutFlow(LayoutFlow.TOP_TO_BOTTOM_IDEOGRAPHIC); // Move the builder out of the shape and back into the main document body builder.moveTo(textBoxShape.getParentParagraph()); // Insert another TextBox textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 150.0, 100.0); textBox = textBoxShape.getTextBox(); // Apply these values to both these members to get the parent shape to defy the dimensions we set to fit tightly around the TextBox's text textBox.setFitShapeToText(true); textBox.setTextBoxWrapMode(TextBoxWrapMode.NONE); builder.moveTo(textBoxShape.getLastParagraph()); builder.write("Text fit tightly inside textbox"); builder.moveTo(textBoxShape.getParentParagraph()); textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); textBox = textBoxShape.getTextBox(); // Set margins for the textbox textBox.setInternalMarginTop(15.0); textBox.setInternalMarginBottom(15.0); textBox.setInternalMarginLeft(15.0); textBox.setInternalMarginRight(15.0); builder.moveTo(textBoxShape.getLastParagraph()); builder.write("Text placed according to textbox margins"); doc.save(getArtifactsDir() + "Shape.TextBox.docx");
public double getInternalMarginRight() / public void setInternalMarginRight(double value)
The default value is 1/10 inch.
Example:
Shows how to insert text boxes and arrange their text.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Insert a shape that contains a TextBox Shape textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 150.0, 100.0); TextBox textBox = textBoxShape.getTextBox(); // Move the document builder to inside the TextBox and write text builder.moveTo(textBoxShape.getLastParagraph()); builder.write("Vertical text"); // Text is displayed vertically, written top to bottom textBox.setLayoutFlow(LayoutFlow.TOP_TO_BOTTOM_IDEOGRAPHIC); // Move the builder out of the shape and back into the main document body builder.moveTo(textBoxShape.getParentParagraph()); // Insert another TextBox textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 150.0, 100.0); textBox = textBoxShape.getTextBox(); // Apply these values to both these members to get the parent shape to defy the dimensions we set to fit tightly around the TextBox's text textBox.setFitShapeToText(true); textBox.setTextBoxWrapMode(TextBoxWrapMode.NONE); builder.moveTo(textBoxShape.getLastParagraph()); builder.write("Text fit tightly inside textbox"); builder.moveTo(textBoxShape.getParentParagraph()); textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); textBox = textBoxShape.getTextBox(); // Set margins for the textbox textBox.setInternalMarginTop(15.0); textBox.setInternalMarginBottom(15.0); textBox.setInternalMarginLeft(15.0); textBox.setInternalMarginRight(15.0); builder.moveTo(textBoxShape.getLastParagraph()); builder.write("Text placed according to textbox margins"); doc.save(getArtifactsDir() + "Shape.TextBox.docx");
public double getInternalMarginTop() / public void setInternalMarginTop(double value)
The default value is 1/20 inch.
Example:
Shows how to insert text boxes and arrange their text.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Insert a shape that contains a TextBox Shape textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 150.0, 100.0); TextBox textBox = textBoxShape.getTextBox(); // Move the document builder to inside the TextBox and write text builder.moveTo(textBoxShape.getLastParagraph()); builder.write("Vertical text"); // Text is displayed vertically, written top to bottom textBox.setLayoutFlow(LayoutFlow.TOP_TO_BOTTOM_IDEOGRAPHIC); // Move the builder out of the shape and back into the main document body builder.moveTo(textBoxShape.getParentParagraph()); // Insert another TextBox textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 150.0, 100.0); textBox = textBoxShape.getTextBox(); // Apply these values to both these members to get the parent shape to defy the dimensions we set to fit tightly around the TextBox's text textBox.setFitShapeToText(true); textBox.setTextBoxWrapMode(TextBoxWrapMode.NONE); builder.moveTo(textBoxShape.getLastParagraph()); builder.write("Text fit tightly inside textbox"); builder.moveTo(textBoxShape.getParentParagraph()); textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); textBox = textBoxShape.getTextBox(); // Set margins for the textbox textBox.setInternalMarginTop(15.0); textBox.setInternalMarginBottom(15.0); textBox.setInternalMarginLeft(15.0); textBox.setInternalMarginRight(15.0); builder.moveTo(textBoxShape.getLastParagraph()); builder.write("Text placed according to textbox margins"); doc.save(getArtifactsDir() + "Shape.TextBox.docx");
public int getLayoutFlow() / public void setLayoutFlow(int value)
The default value is
Example:
Shows how to insert text boxes and arrange their text.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Insert a shape that contains a TextBox Shape textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 150.0, 100.0); TextBox textBox = textBoxShape.getTextBox(); // Move the document builder to inside the TextBox and write text builder.moveTo(textBoxShape.getLastParagraph()); builder.write("Vertical text"); // Text is displayed vertically, written top to bottom textBox.setLayoutFlow(LayoutFlow.TOP_TO_BOTTOM_IDEOGRAPHIC); // Move the builder out of the shape and back into the main document body builder.moveTo(textBoxShape.getParentParagraph()); // Insert another TextBox textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 150.0, 100.0); textBox = textBoxShape.getTextBox(); // Apply these values to both these members to get the parent shape to defy the dimensions we set to fit tightly around the TextBox's text textBox.setFitShapeToText(true); textBox.setTextBoxWrapMode(TextBoxWrapMode.NONE); builder.moveTo(textBoxShape.getLastParagraph()); builder.write("Text fit tightly inside textbox"); builder.moveTo(textBoxShape.getParentParagraph()); textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); textBox = textBoxShape.getTextBox(); // Set margins for the textbox textBox.setInternalMarginTop(15.0); textBox.setInternalMarginBottom(15.0); textBox.setInternalMarginLeft(15.0); textBox.setInternalMarginRight(15.0); builder.moveTo(textBoxShape.getLastParagraph()); builder.write("Text placed according to textbox margins"); doc.save(getArtifactsDir() + "Shape.TextBox.docx");
public TextBox getNext() / public void setNext(TextBox value)
Example:
Shows how to work with textbox forward linkDocument doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Create a few textboxes for example Shape textBoxShape1 = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); TextBox textBox1 = textBoxShape1.getTextBox(); builder.writeln(); Shape textBoxShape2 = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); TextBox textBox2 = textBoxShape2.getTextBox(); builder.writeln(); Shape textBoxShape3 = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); TextBox textBox3 = textBoxShape3.getTextBox(); builder.writeln(); Shape textBoxShape4 = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); TextBox textBox4 = textBoxShape4.getTextBox(); // Create link between textboxes if possible if (textBox1.isValidLinkTarget(textBox2)) textBox1.setNext(textBox2); if (textBox2.isValidLinkTarget(textBox3)) textBox2.setNext(textBox3); // You can only create link on empty textbox builder.moveTo(textBoxShape4.getLastParagraph()); builder.write("Vertical text"); // Thus it's not valid link target Assert.assertFalse(textBox3.isValidLinkTarget(textBox4)); if (textBox1.getNext() != null && textBox1.getPrevious() == null) System.out.println("This TextBox is the head of the sequence"); if (textBox2.getNext() != null && textBox2.getPrevious() != null) System.out.println("This TextBox is the Middle of the sequence"); if (textBox3.getNext() == null && textBox3.getPrevious() != null) { System.out.println("This TextBox is the Tail of the sequence"); // Break the forward link between textBox2 and textBox3 textBox3.getPrevious().breakForwardLink(); // Check that link was break successfully Assert.assertTrue(textBox2.getNext() == null); Assert.assertTrue(textBox3.getPrevious() == null); } doc.save(getArtifactsDir() + "Shape.CreateLinkBetweenTextBoxes.docx");
public Shape getParent()
public TextBox getPrevious()
Example:
Shows how to work with textbox forward linkDocument doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Create a few textboxes for example Shape textBoxShape1 = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); TextBox textBox1 = textBoxShape1.getTextBox(); builder.writeln(); Shape textBoxShape2 = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); TextBox textBox2 = textBoxShape2.getTextBox(); builder.writeln(); Shape textBoxShape3 = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); TextBox textBox3 = textBoxShape3.getTextBox(); builder.writeln(); Shape textBoxShape4 = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); TextBox textBox4 = textBoxShape4.getTextBox(); // Create link between textboxes if possible if (textBox1.isValidLinkTarget(textBox2)) textBox1.setNext(textBox2); if (textBox2.isValidLinkTarget(textBox3)) textBox2.setNext(textBox3); // You can only create link on empty textbox builder.moveTo(textBoxShape4.getLastParagraph()); builder.write("Vertical text"); // Thus it's not valid link target Assert.assertFalse(textBox3.isValidLinkTarget(textBox4)); if (textBox1.getNext() != null && textBox1.getPrevious() == null) System.out.println("This TextBox is the head of the sequence"); if (textBox2.getNext() != null && textBox2.getPrevious() != null) System.out.println("This TextBox is the Middle of the sequence"); if (textBox3.getNext() == null && textBox3.getPrevious() != null) { System.out.println("This TextBox is the Tail of the sequence"); // Break the forward link between textBox2 and textBox3 textBox3.getPrevious().breakForwardLink(); // Check that link was break successfully Assert.assertTrue(textBox2.getNext() == null); Assert.assertTrue(textBox3.getPrevious() == null); } doc.save(getArtifactsDir() + "Shape.CreateLinkBetweenTextBoxes.docx");
public int getTextBoxWrapMode() / public void setTextBoxWrapMode(int value)
The default value is
Example:
Shows how to insert text boxes and arrange their text.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Insert a shape that contains a TextBox Shape textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 150.0, 100.0); TextBox textBox = textBoxShape.getTextBox(); // Move the document builder to inside the TextBox and write text builder.moveTo(textBoxShape.getLastParagraph()); builder.write("Vertical text"); // Text is displayed vertically, written top to bottom textBox.setLayoutFlow(LayoutFlow.TOP_TO_BOTTOM_IDEOGRAPHIC); // Move the builder out of the shape and back into the main document body builder.moveTo(textBoxShape.getParentParagraph()); // Insert another TextBox textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 150.0, 100.0); textBox = textBoxShape.getTextBox(); // Apply these values to both these members to get the parent shape to defy the dimensions we set to fit tightly around the TextBox's text textBox.setFitShapeToText(true); textBox.setTextBoxWrapMode(TextBoxWrapMode.NONE); builder.moveTo(textBoxShape.getLastParagraph()); builder.write("Text fit tightly inside textbox"); builder.moveTo(textBoxShape.getParentParagraph()); textBoxShape = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); textBox = textBoxShape.getTextBox(); // Set margins for the textbox textBox.setInternalMarginTop(15.0); textBox.setInternalMarginBottom(15.0); textBox.setInternalMarginLeft(15.0); textBox.setInternalMarginRight(15.0); builder.moveTo(textBoxShape.getLastParagraph()); builder.write("Text placed according to textbox margins"); doc.save(getArtifactsDir() + "Shape.TextBox.docx");
public int getVerticalAnchor() / public void setVerticalAnchor(int value)
The default value is
Example:
Shows how to change text position inside textbox shape.Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); Shape textBox = builder.insertShape(ShapeType.TEXT_BOX, 200.0, 200.0); textBox.getTextBox().setVerticalAnchor(TextBoxAnchor.BOTTOM); builder.moveTo(textBox.getFirstParagraph()); builder.write("Textbox contents"); doc.save(getArtifactsDir() + "Shape.GetTextBoxAndChangeAnchor.docx");
public void breakForwardLink()
Example:
Shows how to work with textbox forward linkDocument doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Create a few textboxes for example Shape textBoxShape1 = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); TextBox textBox1 = textBoxShape1.getTextBox(); builder.writeln(); Shape textBoxShape2 = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); TextBox textBox2 = textBoxShape2.getTextBox(); builder.writeln(); Shape textBoxShape3 = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); TextBox textBox3 = textBoxShape3.getTextBox(); builder.writeln(); Shape textBoxShape4 = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); TextBox textBox4 = textBoxShape4.getTextBox(); // Create link between textboxes if possible if (textBox1.isValidLinkTarget(textBox2)) textBox1.setNext(textBox2); if (textBox2.isValidLinkTarget(textBox3)) textBox2.setNext(textBox3); // You can only create link on empty textbox builder.moveTo(textBoxShape4.getLastParagraph()); builder.write("Vertical text"); // Thus it's not valid link target Assert.assertFalse(textBox3.isValidLinkTarget(textBox4)); if (textBox1.getNext() != null && textBox1.getPrevious() == null) System.out.println("This TextBox is the head of the sequence"); if (textBox2.getNext() != null && textBox2.getPrevious() != null) System.out.println("This TextBox is the Middle of the sequence"); if (textBox3.getNext() == null && textBox3.getPrevious() != null) { System.out.println("This TextBox is the Tail of the sequence"); // Break the forward link between textBox2 and textBox3 textBox3.getPrevious().breakForwardLink(); // Check that link was break successfully Assert.assertTrue(textBox2.getNext() == null); Assert.assertTrue(textBox3.getPrevious() == null); } doc.save(getArtifactsDir() + "Shape.CreateLinkBetweenTextBoxes.docx");
public boolean isValidLinkTarget(TextBox target)
Example:
Shows how to work with textbox forward linkDocument doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Create a few textboxes for example Shape textBoxShape1 = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); TextBox textBox1 = textBoxShape1.getTextBox(); builder.writeln(); Shape textBoxShape2 = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); TextBox textBox2 = textBoxShape2.getTextBox(); builder.writeln(); Shape textBoxShape3 = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); TextBox textBox3 = textBoxShape3.getTextBox(); builder.writeln(); Shape textBoxShape4 = builder.insertShape(ShapeType.TEXT_BOX, 100.0, 100.0); TextBox textBox4 = textBoxShape4.getTextBox(); // Create link between textboxes if possible if (textBox1.isValidLinkTarget(textBox2)) textBox1.setNext(textBox2); if (textBox2.isValidLinkTarget(textBox3)) textBox2.setNext(textBox3); // You can only create link on empty textbox builder.moveTo(textBoxShape4.getLastParagraph()); builder.write("Vertical text"); // Thus it's not valid link target Assert.assertFalse(textBox3.isValidLinkTarget(textBox4)); if (textBox1.getNext() != null && textBox1.getPrevious() == null) System.out.println("This TextBox is the head of the sequence"); if (textBox2.getNext() != null && textBox2.getPrevious() != null) System.out.println("This TextBox is the Middle of the sequence"); if (textBox3.getNext() == null && textBox3.getPrevious() != null) { System.out.println("This TextBox is the Tail of the sequence"); // Break the forward link between textBox2 and textBox3 textBox3.getPrevious().breakForwardLink(); // Check that link was break successfully Assert.assertTrue(textBox2.getNext() == null); Assert.assertTrue(textBox3.getPrevious() == null); } doc.save(getArtifactsDir() + "Shape.CreateLinkBetweenTextBoxes.docx");