ShapeLastParagraph Property

Gets the last paragraph in the shape.

Namespace:  Aspose.Words.Drawing
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.5
public Paragraph LastParagraph { get; }

Property Value

Type: Paragraph
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.TextBox, 150, 100);
TextBox textBox = textBoxShape.TextBox;

// Move the document builder to inside the TextBox and write text
builder.Write("Vertical text");

// Text is displayed vertically, written top to bottom
textBox.LayoutFlow = LayoutFlow.TopToBottomIdeographic;

// Move the builder out of the shape and back into the main document body

// Insert another TextBox
textBoxShape = builder.InsertShape(ShapeType.TextBox, 150, 100);
textBox = textBoxShape.TextBox;

// 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.FitShapeToText = true;
textBox.TextBoxWrapMode = TextBoxWrapMode.None;

builder.Write("Text fit tightly inside textbox");


textBoxShape = builder.InsertShape(ShapeType.TextBox, 100, 100);
textBox = textBoxShape.TextBox;

// Set margins for the textbox
textBox.InternalMarginTop = 15;
textBox.InternalMarginBottom = 15;
textBox.InternalMarginLeft = 15;
textBox.InternalMarginRight = 15;

builder.Write("Text placed according to textbox margins");

doc.Save(ArtifactsDir + "Shape.TextBox.docx");
See Also