Topic: How to format a RTF File ?

Hello all

I am having fun creating a program with MVD to manage all the snippets published in the forum.
I use a Treeview and an RTF component.
Everything works fine, the ascending sort in the TV is OK, but when the RichEdit displays the text associated with a TV item, the display is not good. (see picture example)
The text in the RichEdit is not identical to that entered during creation.
When creating the text, after each instruction terminated by a semicolon, there is the equivalent of a line break.
In the final result, all the lines are one after the other.
Is there a statement to add to force formatting? I couldn't find anything in the Object Inspector to do this.
Thank you for your help.

JB

Post's attachments

Attachment icon Example.jpg 169.57 kb, 35 downloads since 2023-03-09 

Re: How to format a RTF File ?

Salut Jean,
I hope you and the family are well.
Try using the 'textrtf' function and I think that will fix the problem (please see the attachment).
Regards,
Derek.

Post's attachments

Attachment icon jean rtf problem.zip 438.8 kb, 125 downloads since 2023-03-09 

Re: How to format a RTF File ?

Hello Jean, hello Derek

Jean, it's not entirely clear how the text is formed, where you get the text from and how it looks in HEX.
If you look at the picture, you can not see the control characters
and not always at the end of the semicolon line. There are lines with comments and without semicolon.
Perhaps you need to pay more attention to shaping lines for output in RichEdit.
If possible, a small example.

Re: How to format a RTF File ?

Hello Derek, how are you ?

It Works and well !
Sacred idea the TextRTF function !
Thanks again, you're a boss
JB

Re: How to format a RTF File ?

Hello Sparrow

Sorry to answer now, I saw too late
that your response followed Derek's.
You are right the structure of the text in the RichEdit is badly done.
I will rewrite this program taking Derek's idea into account.
Also, with its feature, there will be less code to write.
Thank you for your interest and good luck, keep it up!
J.B.

Re: How to format a RTF File ?

Hello all!


I had some experience with code shaping( https://k245.ru/en/mvdb-en/code-alignment.html ) and syntax highlighting( https://k245.ru/en/mvdb-en/markup-highlighting.html ).


In the database, I store two versions of the snippet: plain text (for searching and editing)

https://k245.ru/wp-content/uploads/2022/08/izobrazhenie_2022-08-08_145709846-1024x665.png

and formatted (for display).

https://k245.ru/wp-content/uploads/2022/08/izobrazhenie_2022-08-08_145902206-1024x645.png

Визуальное программирование: блог и телеграм-канал.