Styled text

I’m trying to place text into a TextArea alternating left and right aligned. But it won’t do right alignment, only left. Windows 10, 2019.3.1
Help appreciated.

[code]Var st As New StyledText
st = ReceivedMessage.StyledText
ReceivedMessage.AddText(SendMessage.Value + EndOfLine)
SendMessage.Value = “”

Var LastPar As Integer
LastPar = St.ParagraphCount

If IsTextLeft Then
st.Paragraph(LastPar).TextAlignment = TextAlignments.Right
IsTextLeft = False
Else
st.Paragraph(LastPar).TextAlignment = TextAlignments.Left
IsTextLeft = True
End If[/code]

Use Textarea.SelectionAlignment.

Thank you Michael. I’ll look into that.