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

ppReport.LoadFromFile procedure causes application to hang

edited June 2002 in General
I am trying to use the ppReport.Template.LoadFromFile to load a number of
reports into the database. The code below is run for a list of files if
they exist. The problem comes in when an invalid format is encountered.
The program will freeze when executing Template.LoadFromFile on the next
file (even if it is a proper format).


The code:

for x := x to <# of file names in list> do
try
with MainForm.ppReport1 do
begin
{First, Load the template}
Template.SaveTo := stFile;
Template.FileName := ;
Template.LoadFromFile;

{Then, Save it to the Database}
Template.SaveTo := stDatabase;
Template.DatabaseSettings.Name := ;
Template.SaveToDataBase;
end;

except
end;


Any help on this issue would be greatly appreciated.

Regards,

Eric Hansen
eric.hansen@protelinc.com

Comments

  • edited June 2002
    Place a Try..Except around the call to LoadFromFile in case the template
    fails to load. Then you don't want to save the template to the database if
    it raises an ETemplateLoadError exception.

    BTW- You do not have to set the SaveTo property because this is assumed when
    you call the LoadFromFile and SaveToDatabase methods on the template.

    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.