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

Refreshing Letterhead

edited July 2002 in General
I have a collection of 45 reports that I have created using ReportBuilder
which all have our company's letterhead at the top of the page. I have a
copy of the letterhead saved by itself in a .rtm file that I used to load
the reports from when they were originally created. This worked wonderfully
to initially create the reports.

However, the letterhead has changed. Now it seems that I have to go back
and manually update the 45 reports separately to implement the change. I
have tried programmatically calling the Report.Template.LoadFromFile
procedure but the Template only contains the page header band and none of
the detail bands required for the individual letters, so that only resulted
in blank letterhead being printed.

Is there a way to refresh the template? If not, how would I best
re-implement these letters so that a change to the letterhead will be
auto-magically inherited after being only fixed in one place?

Thanks for any input,

--
Michael Simons
Software Programmer
Steven J. Baum P.C.
msimons@mbaum.com

Comments

  • edited July 2002
    The solution is to use a TppSubreport in the header and dynamically load the
    template in to the subreport for the header content. This is demonstrated
    in the RBuilder\Demos\EndUser\DynamicSubreportLoading project. You could
    take this approach for your future reports. However, you should be able to
    edit the template text (much like a dfm format for the object definitions)
    that you currently have in order to delete the components in the header band
    and drop a subreport definition in the template. To see what you need to
    add, drop a subreport into a report and then look at the template after you
    save the template down you should see the object definition of the subreport
    in the header band. The Report.Template.Format should be set to ftAscii.
    If you have binary templates, then you can edit them as ascii text by using
    this converter project:

    http://www.digital-metaphors.com/tips/ConvertBinaryTemplateToASCII.zip


    Cheers,

    Jim Bennett
    Digital Metaphors Corp.

  • edited July 2002
    The point that I should have made more clear is that you do not have to
    rebuild your 45 reports by hand. You can write a program to load the
    reports and change the header bands in code. You can either change them
    this one time for the new information, or you can spend more time and build
    dynamic subreports loading into it. We need to figure out why the detail
    band doesn't load from a template into the report. Can you load the
    template correctly without trying to convert the header band?


    Cheers,

    Jim Bennett
    Digital Metaphors Corp.

  • edited July 2002

  • edited July 2002
    Templates and inheritance do not mix. Anyway, let's save the subreport idea
    for future report solutions. To convert your 45 reports, you can
    sequentially load the 45 templates into one report object. When the report
    template is loaded into the report, you can check the
    Report.HeaderBand.Objects[] array property (there is a Band.ObjectCount
    property to get the count) to loop through the components in the band. Then
    you can check for the components that you want to change. After the loop,
    you can call Report.Template.SaveToFile and it will be saved to the template
    as the new version.


    Cheers,

    Jim Bennett
    Digital Metaphors Corp.

  • edited July 2002

  • edited July 2002
    You wouldn't want to assign headers exactly like this. However, this
    approach might work for you as you have described it. Since you have two
    header band objects, you could loop through the target header band and free
    all of the controls in it. Then loop through the source header band and
    reassign the band property of them to the new report. By assigning the band
    property of a control, you will effectively remove it from the source report
    band and assign it to the target report band. For a TppComponent, the band
    is the parent and the form is the owner.


    Cheers,

    Jim Bennett
    Digital Metaphors Corp.

This discussion has been closed.