Insert text at bottom of shape

hi there,

i have created a shape at the bottom right corner of a page. now i want to add multiple lines of text at the bottom inside this shape. how can i achieve this?

heres some sample code:

shape = New Shape(singleLetter, ShapeType.TextSimple)
shape.AllowOverlap = True
shape.Stroked = False
shape.RelativeHorizontalPosition = RelativeHorizontalPosition.Page
shape.RelativeVerticalPosition = RelativeVerticalPosition.Page
shape.Height = ConvertUtil.MillimeterToPoint(148)
shape.Width = ConvertUtil.MillimeterToPoint(36.5)
shape.Left = ConvertUtil.MillimeterToPoint(165)
shape.Top = ConvertUtil.MillimeterToPoint(130.9)
shape.AppendChild(New Paragraph(singleLetter))
singleLetter.FirstSection.Body.FirstParagraph.AppendChild(shape)
singleBuilder.MoveToParagraph(paragraphCount + 1, 0)
singleBuilder.Writeln(“Line 1”)
singleBuilder.Writeln(“Line 2”)

@bkrack,

Thanks for your inquiry. You are adding the shape and text correctly in the document. Could you please share the issue that you are facing? We will then provide you more information about your query along with code.

the issue i’m facing is, that the added text is aligned at the top of the shape. like i said, i want to align it at the bottom of the shape.

@bkrack,

Thanks for your inquiry. Unfortunately, Aspose.Words does not provide API to align the text vertically within the Text Box. However, we logged this feature request as WORDSNET-17996 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-17996) have been fixed in this Aspose.Words for .NET 19.4 update and this Aspose.Words for Java 19.4 update.

@bkrack,

Regarding WORDSNET-17996, it is to update you that we have added following new property for specifying vertical anchor of shape’s textbox.

/// <summary>
/// Specifies the vertical alignment of the text within a shape.
/// </summary>
/// <remarks>
/// <p>The default value is <see cref="TextBoxAnchor.Top"/>.</p>
/// </remarks>
public TextBoxAnchor VerticalAnchor
{
    get;
    set;
}

This property allows to specify text anchor within shape (Top, Middle, Bottom). Simple use-case is as follows:

Document doc = new Document(inputPath);
NodeCollection shapes = doc.GetChildNodes(NodeType.Shape, true);
Shape textBoxShape = shapes[0] as Shape;
if (textBoxShape != null)
{
  textBoxShape.TextBox.VerticalAnchor = Drawing.Core.TextBoxAnchor.Bottom;
}
doc.Save(outputPath);

However, saving warnings will be thrown for unsupported formats (WordML) and for incompatible Word versions above 2007 (DOC, DOT).