Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Can I use variable into RichEdit?

edited October 2006 in General
Hello, I have one RichEdit in my report, I have my text, but I want to put
in middle of my text a variable value.. can I do these? How I do?

thanks for all

fellipe H.

Comments

  • edited October 2006
    Hi Fellipe,

    You can manually edit the RTF text using the SelText property of the
    TppRichText object. Also if these values can be retrieved from your
    database, you might want to take a look at the Mail Merge feature. There
    are examples of this in the main reporting demo application located in the
    \RBuilder\Demos\1. Reports\... directory.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2006
    Hello Nico,

    I try:

    StringReplace(ppRichText2.SelText, ':ano:', Ano, [rfReplaceAll]);

    but my ppRichText2.SelText show me nothing.... empty... I try
    ppRichText2.Text, and show me RichText2... how I get the text into RichText?

    Thanks for all.
    Fellipe H.


  • edited October 2006
    Fillipe,

    Take a look at Demo 29 located in the \RBuilder\Demos\1. Reports\...
    directory. This demo shows how to use the various RichText routines to
    manually alter your richtext text. I also suggest reading over the RBuilder
    help on these routines and properties as well as the Delphi TRichEdit topics
    as well.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2006
    Hello Nico,
    thanks for your help, but, I look that demo, and I don't find anything about
    to replace a string into RichText... I found only to change Attributes...
    I try:
    ppRichText1.SelectAll;
    StringReplace(ppRichText1.SelText, ':ano:', Ano, [rfReplaceAll]);
    StringReplace(ppRichText1.SelText, ':serie:', Serie, [rfReplaceAll]);

    but, nothing... the ppRichText1.SelText is now returning my strings in
    RichText.. but the StringReplace doesnt work... maybe ppRichText1.SelText is
    set to ReadOnly...

    thanks for all
    Fellipe H

  • edited October 2006
    Hi Fillipe,

    Sorry, I for some reason thought you needed to change the format of the RTF
    document. If you just want to change the text shown, all you need to do is
    alter the TppRichText.RichText property. I also believe you are using the
    StringReplace function incorrectly. This is a function that receives a
    constant string and returns the altered string. Something like the
    following would probably work form the TppRichText.OnPrint event...

    ppRichText1.RichText := StringReplace(ppRichText1.RichText, ':ano:', Ano,
    [rfReplaceAll]);

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.