TextBoxWrapMode enumeration

TextBoxWrapMode enumeration

Specifies how text wraps inside a shape.


SQUAREText wraps inside a shape.
NONEText does not wrap inside a shape.


Shows how to set a wrapping mode for the contents of a text box.

doc = aw.Document()
builder = aw.DocumentBuilder(doc)

text_box_shape = builder.insert_shape(aw.drawing.ShapeType.TEXT_BOX, 300, 300)
text_box = text_box_shape.text_box

# Set the "text_box_wrap_mode" property to "TextBoxWrapMode.NONE" to increase the text box's width
# to accommodate text, should it be large enough.
# Set the "text_box_wrap_mode" property to "TextBoxWrapMode.SQUARE" to
# wrap all text inside the text box, preserving its dimensions.
text_box.text_box_wrap_mode = text_box_wrap_mode

builder.font.size = 32
builder.write("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")

doc.save(ARTIFACTS_DIR + "Shape.text_box_сontents_wrap_mode.docx")

See Also