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

Creating new report dynamically

edited December 2004 in General
I am using TExtraDevices to save a report as html. I want to create a
(non existing) report dynamically and populate a richtext memo.

Report1 : TppReport;
DetailBand1: TppDetailBand;
RichText1: TppRichText;

// try creating on fly start

Report1 := TppReport.Create(Form2);
DetailBand1 := TppDetailBand.Create(Report1);
RichText1 := TppRichText.Create(DetailBand1);

RichText1.RichText := RichString;

// using TExtraDevices to save to file as html
// this blows up
TxUtils.ExportToFile(Report1,edfHTML,FileName);

The last line works if a basic report is created with a richtext memo on
a Detailband.

How can I get this working dynamically?

Thanks, Tom.

Comments

  • edited December 2004
    Hi Tom,

    You need to assign the TppDetailBand.Report and TppRichText.Band property
    for the component to show up inside the report. Something like the
    following...

    var
    lReport: TppReport;
    lDetailBand: TppDetailBand;
    lRichText: TppRichText;
    begin

    lReport := TppReport.Create(Self);
    lDetailBand := TppDetailBand.Create(Self);
    lRichText := TppRichText.Create(Self);

    lDetailBand.Report := lReport;

    lRichText.Band := lDetailBand;

    lRichText.RichText := 'RichText!';

    lReport.Print;


    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2004
    Nico Cizik (Digital Metaphors) wrote:

    Perfect, works great. I thought creating with an owner would do for
    lDetailBand & lRichText as in my code example rather than having to
    assign directly.

    Cheers, Tom.
This discussion has been closed.