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

Creating a report at runtime and then assigning it another report that is on the form at design time

edited July 2003 in General
I have a TppReport on a form, but I want to create a TppReport at runtime
and then assign it everything that is in the first report that I created at
design time. How do i do this?

Thanks,

Rick Whitaker
Iowa Glass Depot

Comments

  • edited July 2003
    Rick,

    You will need to use the Report.Template property to access the template of
    the report you create at run-time and then load that template into the other
    report already on the form. Here is an example of what you might do:

    var
    lMemoryStream: TMemoryStream;
    begin

    lMemoryStream := TMemoryStream.Create;

    try
    myDynamicReport.Template.SaveToStream(lMemoryStream);

    myReport.Template.LoadFromStream(lMemoryStream);

    myReport.Print;

    finally
    lMemoryStream.Free;
    end;

    end;

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2003
    Thanks Nico, that is exactly what I was looking for





This discussion has been closed.