Topic: RTF Font c/p

I'm using the following script for RTF to use specified font rather than default.
However, when c/p from other than MVD RTF apps it always use the copied content font face, size and color. Is it possible to apply specified font after paste into MVD RTF?


frmItems.RichEdit1.Style.TextStyles[0].FontName := 'Segoe UI';
frmItems.RichEdit1.Style.TextStyles[0].Size := 12;
frmItems.RichEdit1.Style.TextStyles[0].Color := clBlack;
frmItems.RichEdit1.ApplyTextStyle(0);
Adam
God... please help me become the person my dog thinks I am.

Re: RTF Font c/p

Are you pasting text with different styles (Bold, Italic...) and want the styles to be preserved?
Or are you satisfied with just text, without styles, pictures and other elements?
How exactly do you insert text (RightMouse>PopUpMenu>Insert or Ctrl+V)?

Re: RTF Font c/p

Hi Sparrow,
Source are different RTF apps and PDF.
Copied / Source RTF or PDF formats not required. I like to paste as in my specified font, style and color via script - the above post #1
I do not paste any pictures in MVD RTF as it doesn't compress pics which results in very large DB.
I insert the text Ctrl+C then Ctrl+V

Adam
God... please help me become the person my dog thinks I am.

Re: RTF Font c/p

See example

Post's attachments

Attachment icon p6-cv.zip 327 kb, 106 downloads since 2023-04-05 

Re: RTF Font c/p

Hi Sparrow,
That's a clever way to do it - I was looking at Adam's question and couldn't think where to start.
Thanks for posting.
Derek.

Re: RTF Font c/p

Hi Derek.


Unfortunately, there is no way to intercept the insertion, button insert and pop-up menu.
I tried the option with dynamic creation of RichEdit but stopped the functions))).
Therefore, I had to use KeyUp.
There is an even more complex option with editing the RTF markup inside the file.

Re: RTF Font c/p

sparrow wrote:

See example


Thank you very much sparrow....
That'll save me lots of clicks. Truly appreciated...

Adam
God... please help me become the person my dog thinks I am.