Home General

Show the text after mailmerge

Hi, there!
I am producing report with mail merge method of richedit. When mail merge complete, I want to show the text of report in a Memo component. But I can only get the text before
mail merging.(the fields are not replaced)
How can I get the text after mail merging?

I am using RIo and RB20.

Thanks in advance.

sincerely, AZA

Comments

  • Hi Yong,

    You can use the OnMailMerge event of the TppRichText component to access the resulting merged RTF or plain text. For your case, you will want to access the TppRichText.PlainText and add it to the Memo.

    Something like the following:

    procedure TForm1.ppRichText1MailMerge(Sender: TObject);
    begin
    Memo1.Lines.Add(ppRichText1.PlainText);

    end;
    I sent a quick example of this to you as well.


    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • Hi, Nico
    Thanks for your response.
    Using Memo1.Lines.Add(ppRichText1.PlainText), the RETURN infomation of the paragraph disappeared.
    I am using RichEdit to show the message. like
    richedit1.Lines.LoadFromStream(ppRichText1.RichTextStream)

    Thank you very much!

    sincerely, AZA

  • Hi Yong,

    Calling the Add routine of TStrings in Delphi will not retain the line break information.

    Try setting the Memo.Lines.Text property instead.

    Memo1.Lines.Text := ppRichText1.PlainText;

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • Hi, Nico

    Thanks for your information!
    Add routine doesn't retain line break! I didn't know that.

    Memo will be faster that Richedit, thank you very much!

    Best Regards,
    AZA
Sign In or Register to comment.