Topic: I found a Bug with RichEdit1.SaveRTF... PLEASE HELP!!!!

Hello, It looks like I found a bug with the code to save and read RichText files RTF not sure if its happening on older versions but I know is happening on version 6.4.

So this is the scenario. I'm using the following code to read and save rich text documents on my projects. Which I had no issues.

       Form1.RichEdit1.LoadRTF(FilePath);
       Form1.RichEdit1.SaveRTF(FilePath,False);
 

After a while of working on my projects I notice that the files were taking a long time to load and the files where getting super big even though I did not had a lot of information. IT seems, the above code is adding extra lines at the beginning of the document and thus is making the .rft document huge.  THIS IS VERY IMPORTANT. It only happens after opening and saving many documents, it seems  Form1.RichEdit1 is not clearing some of the formatting. When I open the program for the first time the issue does not happen and if I click on the icon to create a new document. The issue disappears.

{\listlevel\levelnfc0\leveljc0\li720\fi-360\jclisttab\tx720\levelstartat32{\leveltext\'02\'00.;}{\levelnumbers\'01;}\f1\fs24\cf2}
{\listlevel\levelnfc4\leveljc0\li1440\fi-360\jclisttab\tx1440\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\f1\fs24}
{\listlevel\levelnfc2\leveljc2\li2160\fi-180\jclisttab\tx2160\levelstartat1{\leveltext\'02\'02.;}{\levelnumbers\'01;}\f1\fs24}
{\listlevel\levelnfc0\leveljc0\li2880\fi-360\jclisttab\tx2880\levelstartat1{\leveltext\'02\'03.;}{\levelnumbers\'01;}\f1\fs24}
{\listlevel\levelnfc4\leveljc0\li3600\fi-360\jclisttab\tx3600\levelstartat1{\leveltext\'02\'04.;}{\levelnumbers\'01;}\f1\fs24}
{\listlevel\levelnfc2\leveljc2\li4320\fi-180\jclisttab\tx4320\levelstartat1{\leveltext\'02\'05.;}{\levelnumbers\'01;}\f1\fs24}
{\listlevel\levelnfc0\leveljc0\li5040\fi-360\jclisttab\tx5040\levelstartat1{\leveltext\'02\'06.;}{\levelnumbers\'01;}\f1\fs24}
{\listlevel\levelnfc4\leveljc0\li5760\fi-360\jclisttab\tx5760\levelstartat1{\leveltext\'02\'07.;}{\levelnumbers\'01;}\f1\fs24}
{\listlevel\levelnfc2\leveljc2\li6480\fi-180\jclisttab\tx6480\levelstartat1{\leveltext\'02\'08.;}{\levelnumbers\'01;}\f1\fs24}

Any suggestions on how to fix this issue. I have created a very simple program to replicate the issue. look at the file.rtf inside the folder, view it on notepad++.

Post's attachments

Attachment icon RichText.zip 581.67 kb, 232 downloads since 2020-12-03