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

Big documents / Cleaning template

edited June 2010 in General
Hi !

Is there a faster way to clean a template ?

We are printing some huge invoices (>500 pages) and doing a template.new
before loading the template out of the database.

Now we are facing the problem that after printing such a huge invouice the
"template.new" for the next invoice takes quite long.

Is there a fast way to clean the last printed template (and of course free
the used memory :-)) ?

Thanks,
Wolfgang

Comments

  • edited June 2010
    Hi Wolfgang,

    Making a call to Template.New essentially frees all report objects, bands,
    groups, etc. then makes a call to CreateDefaultBands to recreate an empty
    default report. These steps are necessary to produce a new report template.

    If you would like, you can trace into the routine inside the ppTmplat.pas
    file and see where the slowdown is occurring. Unless the report definition
    itself is very large (not the outputted report), there should be no reason
    for a major delay.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2010
    Hi Nico !

    Hmmm :

    01.06.2010 17:26:13.407 PrintPRN : Start Report.Print...
    01.06.2010 17:47:38.377 PrintPRN : End Report.Print...
    ...
    ...
    01.06.2010 20:47:05.019 DoReport2 : Cleaning template...
    01.06.2010 21:11:16.556 DoReport2 : Loading report from the database...
    ...

    My Source code looks like this :
    ...
    ...
    WriteLog(LogFileName,'DoReport2 : Cleaning template...');
    Report.Template.New;
    WriteLog(LogFileName,'DoReport2 : Loading report from the
    database......');
    Report.Template.LoadFromStream(Stream);
    WriteLog(LogFileName,'DoReport2 : Query setzen...');
    ReportQuery.SQL.Clear;
    ReportQuery.SQL.Add(TheQuery);
    ...
    ...

    Maybe it?s not really necessary to call Template.New since i do a
    Template.Loadfromfile ?
    Does "LoadFromfile" call a "Template.New" ?

    The template itself isnt that big, just about 70kbyte (with some raCode)...

    Regards,
    Wolfgang


  • edited June 2010
    Hi Wolfgang,

    Have you tried removing the call to Template.New? Does that help with the
    load time? The only reason to make this call is to clear the existing
    report and give your user a new default one (same as selecting File | New
    Report from the designer menu. If you are loading a different template,
    there should be no need to make that call.

    --
    Regards,

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

    Best Regards,

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