TTMSFNCRichEditor error or error by myself

I dont get any further.
I don't know if the problem is in the RichEditor or maybe it's me.
I have an array of record. TObject (obj) and TVvalue (val) are stored there.

I have an RTF string in val. I would like to assign this to the RichEditor. That works too.
BUT then the string is no longer contained in my val (!!) as an RTF string, but as plain text.

What's happening?

See also the two images from the debugger.

The 2. screenshot
Screenshot 2023-01-14 160315

I'm not sure I understand what exactly your question is
If you use:

test := val.AsString;

this call to InsertAsRTF() should not affect the val object in any way, especially as you had first assigned it to an intermediate variable test.
I'm afraid this issue must be elsewhere.

Yes, I'm still looking. I'm losing the formatting of the rich text somewhere.

Is it correct that I get the text including the formatting with the Text property?
And plaintext is for the unformatted text

I have found the problem.
The "Text" property holds the plain text and not the RTF text.
I have to use RichEdit.ContentAsRTF !!

We can close here.