Re: Converting text to Rich Text Format
- From: "Peter Olcott" <NoSpam@xxxxxxxxxxxxx>
- Date: Sun, 10 Sep 2006 09:43:55 -0500
That was a good article. Is there any was you can extend this example to solve
my problem? It might make another good article.
A member function of a class that takes three input parameters
(a) text string // std::string or CString, unicode or not
(b) LOGFONT
(c) COLORREF (text foreground color)
and produces one output which is a text string that represents the input after
it has been transformed into RTF. In the ideal case this class would have two
operators: operator=() and operator+=(), the last operator would append this new
RTF text to the prior RTF text, updating the RTF header with additional font
info only when needed. operator=() would always replace the font header info
with the font header corresponding to the new text.
"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message
news:nbh7g2dpt9o0d1h7jj01blat7u9chja4lp@xxxxxxxxxx
See my new essay
http://www.flounder.com/riched20bug.htm
What is amazing is that there is no KB article describing this bug or the
workaround!
joe
On Sat, 09 Sep 2006 18:59:21 -0400, Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
wrote:
OK, the details areJoseph M. Newcomer [MVP]
Version 5.30.12.1211 8/29/2002 6:40am shows the error based on a
misinterpretation of CRLF
sequences
Version 5.30.12.1221 8/4/2004 3:56am does not have the error
The timestamps are those reported by the "Show Modules" debug WIndow in VS.NET
2003.
So it apparently matters which version of DLL you are using. I'm going to
have to put a
test in to make sure that I do the right compensation. I have to check to see
if Riched20
is redistributable. My recollection was that it wasn't.
joe
On Sat, 09 Sep 2006 15:52:20 -0400, Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
wrote:
What is really strange is that on my laptop I *don't* get the creep. I wasJoseph M. Newcomer [MVP]
just out
somewhere where my role had been to provide transportation, but I had nothing
to do. I
noticed the "inverse creep". I will compare control DLL versions and report
back when I
have my laptop up again.
I suspected that, but when I replaced \r\n with just \n, the text looks the
same (unlike
an ordinary CEdit) but the count is still wrong.
joe
On Sat, 09 Sep 2006 00:19:11 -0700, "Mihai N." <nmihai_year_2000@xxxxxxxxx>
wrote:
Joseph M. Newcomer [MVP]There is a "creep" where the SetSelection selects the wrong text depending
on how many
lines precede the text. No, I don't know what is wrong here, and there
appears to be no
documentation about the problem, but I noticed that the colors were slowly
moving to the right.
I'm not sure this will work correctly in the presence of line wrap, but
all
my output fits on one line at the moment.
Some time ago I have noticed that a "\r\n" (0d 0a) in the original string
ends up counted as one character in the RTF (probably the \par).
So:
rtfControl.AddString( "a\r\n" );
rtfControl.AddString( "b\r\n" );
rtfControl.AddString( "c\r\n" );
means a#b#c# (# = "paragraph character", whatever that is in the belly of
the
rtf control.) So trying to select the first line (length 3, in the original
text) will end up selecting a#b
And the more lines you have, the worse it gets :-)
I am not sure if this is your case, but I though it is worth mentioning.
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Follow-Ups:
- Re: Converting text to Rich Text Format
- From: Joseph M . Newcomer
- Re: Converting text to Rich Text Format
- References:
- Converting text to Rich Text Format
- From: Peter Olcott
- Re: Converting text to Rich Text Format
- From: Joseph M . Newcomer
- Re: Converting text to Rich Text Format
- From: Peter Olcott
- Re: Converting text to Rich Text Format
- From: Joseph M . Newcomer
- Re: Converting text to Rich Text Format
- From: Peter Olcott
- Re: Converting text to Rich Text Format
- From: Joseph M . Newcomer
- Re: Converting text to Rich Text Format
- From: Peter Olcott
- Re: Converting text to Rich Text Format
- From: Joseph M . Newcomer
- Re: Converting text to Rich Text Format
- From: Mihai N.
- Re: Converting text to Rich Text Format
- From: Joseph M . Newcomer
- Re: Converting text to Rich Text Format
- From: Joseph M . Newcomer
- Re: Converting text to Rich Text Format
- From: Joseph M . Newcomer
- Converting text to Rich Text Format
- Prev by Date: 2 CListCtrl with one hor. scrollbar
- Next by Date: Multiple Views: how to open both views at startup or on new document
- Previous by thread: Re: Converting text to Rich Text Format
- Next by thread: Re: Converting text to Rich Text Format
- Index(es):
Relevant Pages
|