CopyRTF very slow

General TRichView support forum. Please post your questions here
Post Reply
standay
Posts: 274
Joined: Fri Jun 18, 2021 3:07 pm

CopyRTF very slow

Post by standay »

Hi Sergey,

I'm using the latest version 21.3 of the rve.

It looks like CopyDef will automatically copy RVF, ANSI text, Unicode text, and RTF text from the rve selection. However, it was sometimes very slow to work. After some checking I found that it was the CopyRTF where things slowed down, usually when images were involved.

I first tried removing the rvoAutoCopyRTF option from the rve options in design time, but it seems to be ignored in runtime. So, I removed that option in my code anywhere I was calling CopyDef and that did work:

Code: Select all

rv.Options := rv.Options - [rvoAutoCopyRTF];
Could you check and see if removing the rvoAutoCopyRTF option in design time works for you? I tried it in 2 different rve's and I had to code around it in both.

Also, is it normal for CopyRTF to take a lot longer than other copy formats? At least when pictures are involved?

Thanks Sergey

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

Re: CopyRTF very slow

Post by Sergey Tkachenko »

Do you use VCL version?
I tried to exclude rvoAutoCopyRTF from rve in RichViewActions\Demos\DelphiUnicode\ActionTest_MultiRes\ demo, and it worked as expected: RTF was not copied by CopyDef.

RTF content can be huge, so it is really may be saved much longer than other formats.
Make sure that you have the following options included in RTFOptions: rvrtfSaveJpegAsJpeg, rvrtfSavePngAsPng. If not, Jpeg and Png images will be converted to bitmaps (maybe encapsulated in metafiles, depending on other RTFOptions), and will have too large size.
Also, you can include rvrtfSavePicturesBinary in RTFOptions. With this option, RTF will be smaller and will be saved faster, but the result is less compatible.
standay
Posts: 274
Joined: Fri Jun 18, 2021 3:07 pm

Re: CopyRTF very slow

Post by standay »

Hi Sergey,

Yes, vcl, I don't have lazarus and I don't do any fmx.

I watched the code after I excluded rvoAutoCopyRTF in design time and it still ran the copyrtf in copydef. I checked my code to make sure I wasn't changing the option somewhere and I couldn't find it. At any rate, it works the way I have it now. If I get a chance I'll look at it again.

I have the RTFOptions set the way you outlined. I don't mind larger files so no real need to use rvrtfSavePicturesBinary, but good to know it's there.

Good to know on the RTF as well. Just making sure I didn't do something to cause that. I added a menu item to let me save in rtf when needed. I rarely need that so it's fine as a separate function.

Thanks Sergey.

Stan
Post Reply