Hi Stan

I just use the richedit copy and paste functions.

use RE1 sellength to select required text on RE1
then use copytoclipboard.

Now paste clipboard data into RE2

I use this for generating barcode data using fonts drawn
into rich edit. The select richedit contents and copy to the
clipboard.

Now pasting clipboard data into any richedit based control
will produce the required data including formatting.

Hope this helps

regards
Neil



----- Original Message -----
From: "Stan" <drst...@gmail.com>
To: <delphi@elists.org>
Date: Wed, 27 May 2009 06:03:53 -0700
Subject: RichEdit - copying formatted text from/to

> Hello,
> 
>    I want to copy some lines from one RichEdit to another, say, lines
> 2-4 of RE1 into (empty) RE2.
>    Using RE2.Lines.Add(RE1.Lines[3]) only copies the text, not the 
formatting.
>    How can I copy text and formatting of selected lines?
> 
>    The larger issue:
> 
>    I want to display any of a dozen sets of information (rich edit
> text), depending upon which button is clicked.  I don't want to have
> to manage a dozen separate .RTF files (i.e., read the appropriate .RTF
> file into my form's RichEdit).  I'd rather have a single .RTF file and
> use delimiter lines (e.g., a line with just an "=") to separate the
> different buttons' associated information.  Currently, I LoadFromFile
> the single .RTF file into a (hidden) RichEdit (this retains the
> formatting), then search for the n-th delimiter line and copy, into
> RE2, the text between that line and the next delimiter line, using the
> code shown above.  However, that method loses the formatting.
> 
>    I'm using D5.  I'm also using Raize Components' tRzRichEdit,
> although I doubt that adds or subtracts anything from tRichEdit that
> might be useful in this situation.
> 
>    All suggestions most welcome.
> 
> Thanks,
> -- Stan
> _______________________________________________
> Delphi mailing list -> Delphi@elists.org
> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
> 
_______________________________________________
Delphi mailing list -> Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to