Set Text Alignment in a shape

Posted by: stephc on 8 September 2017, 3:25 pm EST

  • Posted 8 September 2017, 3:25 pm EST

    VB NET, Spread 7.35

    Hi,

    Please, How to set the alignment of a text in a Shape

    This is my code

    Dim SHP As FarPoint.Win.Spread.DrawingSpace.PSShape
    SHP = New DrawingSpace.RectangleShape
    SHP.Width = 800
    SHP.Height = 350
    SHP.Left = (FP.Width - SHP.Width) / 2
    SHP.Top = 50

    'Text.........................................................................
    SHP.CanRenderText = True ' >>>>> OK
    SHP.TextWrap = True ' >>>>> OK
    SHP.Text = "Hello Every Body..." ' >>>>> OK
    SHP.Font = New Font("Monotype Corsiva", 20, FontStyle.Bold) ' >>>>> OK
    SHP.ForeColor = Color.Red ' >>>>> OK
    SHP.AlignText = TextAlign.TextTopPictBottom ' >>>>> Not Effect (and other options as well)
    '................................................................................
    'And ....
    SHP.AlignHorz = FarPoint.Win.HorizontalAlignment.Left
    SHP.AlignVert = FarPoint.Win.VerticalAlignment.Bottom
    ' As also no Effect

    FP.ActiveSheet.AddShape(SHP)
    SHP.Refresh()


    In this example, the text is always centered


    Thank you

    Stephane
  • Replied 8 September 2017, 3:25 pm EST

    Hi Stephane,

    I used the code same as your and found the Text in shape aligned to left bottom. Refer to the attached image.
    I am using Spread v10.40.20171.0. Please test the attached sample application and let me know in case the issue still persists.

    Regards,
    Deepak Sharma
    2017/05/SPShapeTextAlign.zip


  • Replied 8 September 2017, 3:25 pm EST

    Hello

    I'm sorry but the problem remains the same (Look at the attachment) with exactly the same code.

    (Spread 7.35)

    Do you have an idea ??

    Thank you

  • Replied 8 September 2017, 3:25 pm EST

    Ps

    And note that in the attached image that you send to me, the text is aligned at the bottom with the "FarPoint.Win.TextAlign.TextTopPictBottom" request
  • Marked as Answer

    Replied 8 September 2017, 3:25 pm EST

    Hi,

    I suggest not setting TextWrap or TextAlign -- those properties do not show when editing the shape properties in the Spread Designer, and I find that adding a rectangle shape as you describe and setting AlignH and AlignV do make the text draw using those settings.

    Regards,
    -Sean
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels