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

Load templates Files

edited May 2004 in General
I'm writting an application thtat allow user to select RB files (.rtm) and
then preview or printing the report. Here is the code I have use to do this:

if OpenDialog.execute then
try
ppReport1.Template.FileName = OpenDialog.FileName;
ppReport1.LoadFromTemplate;
ppReport1.Print;
except
ON ...
end;

The program compile well, I run the program, no runtime errors are raised
but the result is a blank page.

What I'm doing wrong ?

[]s,

JR

Comments

  • edited May 2004
    Hi JR,

    The code below seems to be fine. Be sure the OpenDialog.FileName is
    providing the entire path to the Template.FileName property. Also be sure
    the template you are loading is actually a finished report. As a test,
    create a simple application consisting of a form with an empty report and a
    button. Inside the button's OnClick event, hard code the report path and
    file name to be sure it works correctly.

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    ppReport1.Template.FileName := 'C:\Test.rtm';
    ppReport1.Template.LoadFromFile;

    ppReport1.Print;
    end;

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2004
    Nico,

    I think I found the nature of the problem. I don't know why but after
    calling the LoadFromFIle, the DataPipeline property is cleared from the
    report. All I have to do is set the Datapipeline again and everything works
    fine.


  • edited May 2004
    Hi Junior,

    ReportBuilder will automatically loop through all components on the main
    form or a datamodule for the proper datapipelines. If by chance you are
    creating a datapipeline in code with no owner or an owner that ReportBuilder
    cannot search, then you will not see the datapipeline when running the
    report, unless you set the pipeline again manually as you have already done.


    --
    Best Regards,

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