Working with TextBoxes

In Aspose.Words, TextBox class is used to specify how a text is displayed inside a shape. It provides a public property named as parent to get the parent shape for the text box to allow customer to find linked Shape from linked TextBox.

TextBox class provides is_valid_link_target method in order to check whether the TextBox can be linked to the target Textbox.

The following code example shows how to check if the TextBox can be linked to the target Textbox:

Check TextBox Sequence

There are several ways to display text in a shape. The text_box can be the Head, Middle, or Tail of a sequence.

The following code example shows how to check if TextBox is a Head, Tail, or Middle of the sequence:

# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Python-via-.NET
doc = aw.Document()
shape = aw.drawing.Shape(doc, aw.drawing.ShapeType.TEXT_BOX)
textBox = shape.text_box
if (textBox.next != None and textBox.previous == None) :
print("The head of the sequence")
if (textBox.next != None and textBox.previous != None) :
print("The Middle of the sequence.")
if (textBox.next == None and textBox.previous != None) :
print("The Tail of the sequence.")

Using the text_box method you can break the link to the next TextBox.

The following code example shows how to break a link for a TextBox: