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

How to assign external rich text file (.RTF) to TppRichtext

edited October 2014 in General
Hello

I have a TppRichText on a detail band of a report definition.

How can I assign an external rtf file eg. test.rtf to the TppRichText on the
detail band ?

Many Thanks


Kamran

Comments

  • edited October 2014
    Hi Kamran,

    You can use the LoadFromFile or LoadFromRTFStream routines to load RTF
    data into a TppRichText control. See the TppRichText documentation for
    more information about these routines.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2014
    Hi Nico

    Thanks for the help. I have checked the guide but
    I was just not sure how to properly structure my statement.

    The richtextholder is on the detail band of the report and I simply wanted
    to replace what is there
    in the run time editor with a rich text file of my own.

    so is it something like:

    ReportFrm.LetterLayout.DetailBand.RichTextHolder.LoadFromFile('myfile.rtf');



    thanks

    Kamran

  • edited October 2014
    wrote:


    If the RTF file can change at every detail record, then:

    procedure TReportFrm.ppDetailBand1BeforePrint(Sender: TObject);
    var
    fName: string;
    begin
    fName:= ;

    if FileExists(fName) then
    ppRichText1.LoadFromFile('fName')
    else
    ppRichText1.RichText:=''; // clear previously loaded RTF text
    // ppRichText1.Clear; instead?
    end;


    If it never changes, then just put the same code in your
    TReportFrm.OnCreate event.


    Cheers,
    EdB
This discussion has been closed.