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

Create a Header when report is printing

edited December 2003 in End User
Hi,

I want to put a "information" header on top of each report before it is
printed.

Let say that the user create their own report or modyfying our reports.
Before it is printed (screen,printer) I want to check if there is an
existing header/subreport, the name of the header and if the header name
isn't as expected or missing I want to create my own header (might be a
template, or programatically) to be added at the top of each page
regardless if there is a header or not.

I suppose the easiest way to do this is by adding a subreport on top of the
header but not sure how to do this.


/Ronny

Comments

  • edited December 2003

    See the CodeBased thread of the Tech Tips newsgroup for an article on create
    subreports in code.

    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2003
    Nard,

    Obvious, I was looking in the tech-tips but seems to missed it.
    Thanks.

    /Ronny
  • edited December 2003
    Nard,

    I got the subreport to be created and printed on the report.
    But if the report already contain a subreport in the header my subreport
    will be printed underneath the existing one.
    How can I get my subreport to be at the top of the page.

    /Ronny
  • edited December 2003

    When SubReports are set to PrintBehavior of pbChild, the print order is
    controlled by setting

    subreportB.ShiftRelativeTo := subReportA.

    When SubReports are set to PrintBehavior of pbSection, the print order is
    controlled by using BringToFront and SendToBack to control the Z-order of
    the elements in the Band. Use the Report Tree tool windows to visually see
    the Z-order.

    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2003
    Nard,

    I understand but as the subreports are created in code I don't think I can
    see them by using the Tree tool.

    Another one. I create the header subreports in my app. before the report is
    printed and this works fine, but I want to create the header subreports
    when the user print them from the designer as well.

    How to do this?

    /Ronny
  • edited December 2003

    Try using the Report.Template.OnLoadEnd event to create subreports in code.
    This fires just after the report is loaded.




    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2003
    Nard,

    That's work but I don't wnat the header/subreport visible when the template
    is loaded. I don't want the end user to have access to them.

    I want them on the report when the end-user print them (screen/printer)
    from the RBDesigner.

    Have looked for an OnBeforePrint but can't find it.
  • edited December 2003

    1. So you want to add subreports when the end-user selects the Preview tab
    in the report designer and then you want to delete them when the end-user
    returns to the Design tab?

    Try using the TppDesigner.OnTabChange event for this.

    2. The other case you would need to handle is the one in which the user
    prints/previews directly from the report explorer. You could use a custom
    report explorer form to handle this.


    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2003
    Nard,

    Sorry, but it allmoast work.
    Yes, It trigger the event but when the subeport is added to the header the
    "RBDesigner" put the user back to the "Designer" tab, however I can see in
    the "background" that the "Calculatin page # of #" is running.


    /Ronny
  • edited December 2003

    Sorry, but you are trying to accomplish something that RB was not designed
    to support.

    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited January 2004
    Nard,

    I understand, as we "almoast are there" is it possible to add it as an
    user suggestion for future releases?

    /Ronny



  • edited January 2004

    I can add this to the ToDo list, but I cannot guarantee that it make into a
    future release. This is a low priority item


    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited January 2004
    Fair enough.

    /Ronny

This discussion has been closed.