Help with formatted text please

On Windows…

I have 5 TextAreas with formatted text, each one is formatted differently.

I would like to copy the formatted text in those TextAreas into a single TextArea each formatted string going in a new line.

How do I do that?

Thanks.

Lennox

Loop thru the style-runs of each of your 5 TA’s and append them to the Style-run for your 6th one.

Hi Dave,

Could you provide some code? I looked at the example and I looked at the LR but it seems a bit too complicated for me.
Thanks.

Lennox

I was trying this

    TextArea1.SelLength = Len(TextArea1.Text)
    TextArea1.Copy
    TextArea11.SelStart = 0
    TextArea11.Paste
    
    Chr13TF.SelLength = Len(Chr13TF.Text)
    Chr13TF.Copy
    TextArea11.SelStart = Len(TextArea11.Text)
    TextArea11.Paste
    
    TextArea2.SelLength = Len(TextArea2.Text)
    TextArea2.Copy
    TextArea11.SelStart = Len(TextArea11.Text) + 2
    TextArea11.Paste
    
    Chr13TF.SelLength = Len(Chr13TF.Text)
    Chr13TF.Copy
    TextArea11.SelStart = Len(TextArea11.Text)
    TextArea11.Paste
    
    TextArea3.SelLength = Len(TextArea3.Text)
    TextArea3.Copy
    TextArea11.SelStart = Len(TextArea11.Text) + 2
    TextArea11.Paste
    
    Chr13TF.SelLength = Len(Chr13TF.Text)
    Chr13TF.Copy
    TextArea11.SelStart = Len(TextArea11.Text)
    TextArea11.Paste
    
    TextArea4.SelLength = Len(TextArea4.Text)
    TextArea4.Copy
    TextArea11.SelStart = Len(TextArea11.Text) + 2
    TextArea11.Paste
    
    Chr13TF.SelLength = Len(Chr13TF.Text)
    Chr13TF.Copy
    TextArea11.SelStart = Len(TextArea11.Text)
    TextArea11.Paste
    
    TextArea5.SelLength = Len(TextArea5.Text) + 2
    TextArea5.Copy
    TextArea11.SelStart = Len(TextArea11.Text)
    TextArea11.Paste

Chr13TF.SelLength is a text field with a carriage return

I got the style but they were in the same line.

Lennox

  Dim i As Integer
  Dim j As Integer
  Dim st As StyledText
  For i=0 To 4 ' assuming you have a control array of your TextAreas
    st=textarea1(i).StyledText
    For j=0 To st.StyleRunCount-1
      Dim sr As New StyleRun // create a CLONE of existing STylerun
      sr.Bold=st.stylerun(j).bold
      sr.Font=st.StyleRun(j).Font
      sr.Italic=st.StyleRun(j).Italic
      sr.Size=st.StyleRun(j).Size
      sr.text=st.StyleRun(j).Text
      sr.TextColor=st.StyleRun(j).TextColor
      sr.Underline=st.StyleRun(j).Underline
      '
      destTextArea.StyledText.AppendStyleRun sr  // puts new stylerun in DESTINATION Text Area
    Next j
    
  Next i

oops… wrong button :slight_smile:

If you DO NOT have a control array… I highly suggest converting to using one

textarea1(1), textarea1(2) etc… [see MEMBER OF on the inspector]

Thanks Dave.
Lennox