Very large RTF result for small text

General TRichView support forum. Please post your questions here
Post Reply
gdemers_logilys
Posts: 13
Joined: Mon Jun 16, 2014 1:10 pm

Very large RTF result for small text

Post by gdemers_logilys » Thu May 03, 2018 3:15 pm

Hello,

Lately some users have a big problem. In my application, I load the text from an RTF string in a SqlServer table and save it back after edits.

I don't know what happens, but sometimes, when users copy text from outlook mail messages and paste them in the TRichView, the result RTF is VERY Large. Before the paste, the RTF content was about 40 000 characters, after the paste of a small paragraph, its about 3 000 000 characters.

I can't find reproduce it on demand even if I paste the same part of outlook message in another TRichView.

In the RTF content, a lot of strange things are added. I don't know where to look.

Example #1 (thousands of things like that are added) :

{\list\listtemplateid1155693678\listsimple1
{\listlevel\levelnfc23\leveljc0\li360\fi-360\jclisttab\tx360{\leveltext\'01\u183 \'b7;}{\levelnumbers;}\f12\fs24}
\listid2081270314}
{\list\listtemplateid626966745\listsimple1
{\listlevel\levelnfc23\leveljc0\li360\fi-360\jclisttab\tx360{\leveltext\'01\u183 \'b7;}{\levelnumbers;}\f12\fs24}
\listid1830431809}


Example #2 (thousands also) :

{\list\listtemplateid1373810506
{\listlevel\levelnfc23\leveljc0\li720\fi-360\jclisttab\tx720{\leveltext\'01-;}{\levelnumbers;}\f7\fs24}
{\listlevel\levelnfc23\leveljc0\li1440\fi-360\jclisttab\tx1440{\leveltext\'01o;}{\levelnumbers;}\f13\fs24}
{\listlevel\levelnfc23\leveljc0\li2160\fi-360\jclisttab\tx2160{\leveltext\'01\u61607 ?;}{\levelnumbers;}\f11\fs24\lang1024}
{\listlevel\levelnfc23\leveljc0\li2880\fi-360\jclisttab\tx2880{\leveltext\'01\u61623 ?;}{\levelnumbers;}\f3\fs24\lang1024}
{\listlevel\levelnfc23\leveljc0\li3600\fi-360\jclisttab\tx3600{\leveltext\'01o;}{\levelnumbers;}\f13\fs24}
{\listlevel\levelnfc23\leveljc0\li4320\fi-360\jclisttab\tx4320{\leveltext\'01\u61607 ?;}{\levelnumbers;}\f11\fs24\lang1024}
{\listlevel\levelnfc23\leveljc0\li5040\fi-360\jclisttab\tx5040{\leveltext\'01\u61623 ?;}{\levelnumbers;}\f3\fs24\lang1024}
{\listlevel\levelnfc23\leveljc0\li5760\fi-360\jclisttab\tx5760{\leveltext\'01o;}{\levelnumbers;}\f13\fs24}
{\listlevel\levelnfc23\leveljc0\li6480\fi-360\jclisttab\tx6480{\leveltext\'01\u61607 ?;}{\levelnumbers;}\f11\fs24\lang1024}
\listid1311250550}

Example #3 (thousands also) :

{\listoverride\listid100488248\listoverridecount0\ls1499}
{\listoverride\listid859099015\listoverridecount0\ls1500}
{\listoverride\listid1527722557\listoverridecount0\ls1501}
{\listoverride\listid1560440348\listoverridecount0\ls1502}
{\listoverride\listid1511595747\listoverridecount0\ls1503}
{\listoverride\listid661813843\listoverridecount0\ls1504}
{\listoverride\listid708886570\listoverridecount0\ls1505}
{\listoverride\listid1159866920\listoverridecount0\ls1506}
{\listoverride\listid458251280\listoverridecount0\ls1507}
{\listoverride\listid969036703\listoverridecount0\ls1508}

Sergey Tkachenko
Site Admin
Posts: 14035
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Very large RTF result for small text

Post by Sergey Tkachenko » Thu May 03, 2018 3:26 pm

Sometimes, unused list styles are added when importing RTF.
Call RichViewEdit.DeleteUnusedStyles(True, True, True) after loading to delete them.

If you use TDBRichViewEdit, assign its property AutoDeleteUnusedStyles = True.

gdemers_logilys
Posts: 13
Joined: Mon Jun 16, 2014 1:10 pm

Re: Very large RTF result for small text

Post by gdemers_logilys » Thu May 03, 2018 5:57 pm

Wow. Thank you. It works fine.

Every time I post you have the right solution and real fast too.

Thanks a lot and have a nice day.

Post Reply