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

Richtext Rap example

edited February 2004 in End User
Are there any example of compiling a Richtext from RAP, setting
different lines with different fonts and size?

We have an end user report (D5, RB 702, DOA) which prints a table of
contents using the usual tecnique (two pass and rap populating a memo)
Now our customer ask to see different font in the toc, so we need to
change from standard memo to richtext.

Thanks
Bye
Nicola

Comments

  • edited February 2004
    One problem I see, for example, is that while Delphi TRichEdit has a
    Lines property, here we have a simple RichText (a string).
    So while in Delphi adding a whole line is simply a matter of

    RichEdit.Lines.Add('A new line');

    to do the same with TppRichText I tried

    RichText1.RichText := RichText1.RichText + chr(13) + 'A new line' + chr(13);

    but I only see the first row
  • edited February 2004

    I think the problem is that the ppRichText1.RichText contains the formatted
    RichText and as part of this there is an end of file indicator.

    Try breaking this into two parts. In the first part build up a TStringList
    of the table of contents. You probably already have this code from the
    current version of the report that uses a memo.

    Asssign the TStringList data to the RichText:

    myRichText.RichText := myStringList.Text;

    In a second step use the TppRichText.SelStart, SelLength, SelAttributes to
    format the RichText..




    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.