Replace text in TppRichView

General TRichView support forum. Please post your questions here
Post Reply
Mauro

Replace text in TppRichView

Post by Mauro »

Hello, it's me again :-)

Does exist a Demo or some help topic that explains how to replace text in the TppRichView (or a workaround)?
I'm trying to do a MailMerge engine.

Regards,

Mauro.
Michel
Posts: 92
Joined: Fri Oct 14, 2005 2:56 pm
Contact:

Post by Michel »

Hi Mauro, it's me again too :wink:
Yes, there's the "Mail Merge" demo towards the middle of http://www.trichview.com/download/demo.html
Should give you some initial ideas.
Michel
Mauro

Post by Mauro »

Hi,

I've already seem these demos.

But I've not found .InsertText nor anything like this in TppRichView (the rich view for ReportBuilder).
I'd know if in fact there's no way to do this directly in TppRichView. If no then I'll use an invisible TRichViewEdit, replace the text using the idea existing in the demo, and at last save the RVF from TRichViewEdit to TppRichView.

Thanks,

Mauro.
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

There are many mailmerge demos (you can see them all here: http://www.trichview.com/forums/viewtopic.php?t=8 ), and none of them requires editor or InserText method. All of them work with TRichView (and TRichView object is accessible as ppRichView.RichView)
Mauro

Post by Mauro »

Hello,

Excuse me by the insistence...

I've read the demos, but haven't understood the engine.

I'm using the following to do the replacement in the RichViewEdit:

Code: Select all

  
  //Go to begin
  Item  := 0;
  Off   := rveTexto.GetOffsBeforeItem(Item);
  rveTexto.SetSelectionBounds(Item,Off,Item,Off);
  //Replace
  while rveTexto.SearchText(Old, [rvseoDown]) do
    rveTexto.InsertText(New);
Is there any way as simple as this to do the same using RichView?
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

No, you cannot use these methods in TRichView.

It's not necessary to understand mail-merge demos code completely. Usually, you can just copy the main procedure (FillFields) in you project without changes.

Or, as you suggested initially, use a hidden richviewedit. It's ok, but much slower.
Post Reply