Home Subreports

Duplicating subreports

edited March 2010 in Subreports
Is there an easy way to duplicate a subreport multiple times? I have a
subreport to print a list of employees in a vertical column and I need to
duplicate it once per department. Some of the calculated variables change,
but most of the same report will be identical.

Saving the finished subreport to a file and loading it into a new blank
subreport didn't work.

RB version 10.06

Comments

  • edited March 2010
    Hi Steve,


    What types of problems are you having with this method of copying
    subreports?? This would be the easiest way to duplicate the same subreport
    numerous times. If fact, you wouldn't event have to save the report to
    file, you could save it to a memory stream and then load it into other empty
    subreports on the fly in code...

    Subreport.Report.Template.SaveToStream(aStream);

    SubreportCopy.Report.Template.LoadFromStream(aStream);

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2010
    When I load from file into a new, blank subreport, it tells me essentially
    that my group is invalid. When I create another subreport manually, my group
    (based on employee department) is assigned a new group number, like this:

    Main Report - Group1 (Division)
    Subreport1 - Group2 (Department)
    Subreport2 - Group3 (Department)

    So, when I save Subreport1 as a file and try to load it into a new, blank
    Subreport3, the load fails because Group2 already exists in Subreport1 and
    cannot exist again in Subreport3.

    Steve


  • edited March 2010
    Hi Steve,

    Yes sorry, I was thinking about copying to separate reports.

    In this case you would either need to go through the template code and
    change the group names to something unique or create the subreports
    completely in code.

    http://www.digital-metaphors.com/rbWiki/Delphi_Code/Layouts/Create_SubReport_in_Code

    http://www.digital-metaphors.com/rbWiki/Delphi_Code/Layouts/Create_Group_in_Code

    --
    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.