Page 1 of 1

replace every occurrence of a text by another text

Posted: Wed Apr 02, 2008 3:09 pm
by Usch Wildt
Hi,

it sounds very simple, but I dont' find a way for this:

I habe a formatted text in a TRichViewEdit control.
There can be tables in the text.

Now I want to find any occurence (also in tables) of a text snippet, e.g. "xyz" and replace it by another text, e.g. "example text".

The formatting of the replaced text shall be the same as in the original text, e.g. if one ocurrence of "xyz" is bold, the "example text" shall also be bold this time.
If the next occurence of "xyz" is italic, the "example text" shall also be italic this time.

SearchText and InsertText seem to crash with tables.
In your field-replace-examples the fields have special formats and are seperate items.
So both ways don't work for me.

Could you give me a small C++ code example?

Thanks a lot!

Usch Wildt

Posted: Sun Apr 06, 2008 7:48 am
by Sergey Tkachenko
SearchText and InsertText must work in tables.
You can see the demo in "Demos\CBuilder\Assorted\Search and Replace\"
Replace All command is implemented there.