A little help for RichEditor

Please give me a little help.
For 3 hours I've been trying to display a list of RTF texts formatted in RichEditor.
I get the data from a REST service TList<MyMemo>

  • I want a horizontal line.
  • Then a hyperlink and a date
  • Another line below.
  • Then the RTF text.
  • And finally another line.

All of this is called in a loop.
The font will be changed if necessary.

The RTF text is displayed correctly, but the positions of the lines are always wrong. Sometimes a line jump is missing, sometimes it's one too many and sometimes the lines are at the very end.

Thank you
Thomas

      edRichMemo.AddLine( clRed, 3, TPenStyle.psDash);
      edRichMemo.GotoTextEnd;

      edRichMemo.SetSelectionAttribute( 'Segoe UI', 9, [], clBlack, clWhite);
      edRichMemo.AddHyperlink( 'Bearbeiten', 'edit://' + LPersonMemo.MemoID.ToString);
      edRichMemo.SetSelectionAttribute( 'Segoe UI', 12, [TFontStyle.fsBold], clRed);
      edRichMemo.AddText( '    ' + FormatDateTime( 'dd.mm.yyyy hh:nn', LPersonMemo.MemoDatum) + ' ' + LPersonMemo.Code.ValueOrDefault);
      edRichMemo.AddLineBreak;
      edRichMemo.GotoTextEnd;

      edRichMemo.AddLine( clRed, 1, TPenStyle.psDot);
      edRichMemo.GotoTextEnd;

      edRichMemo.SetSelectionAttribute( 'Segoe UI', 10, [], clBlack, clWhite);
      edRichMemo.InsertAsRTF( LPersonMemo.Memo);
      edRichMemo.GotoTextEnd;
      edRichMemo.AddLineBreak;
      edRichMemo.GotoTextEnd;
      edRichMemo.AddLine( clRed, 3, TPenStyle.psDash);
      edRichMemo.GotoTextEnd;