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

Setting report printersetup values for all reports

edited September 2002 in General
I have been chasing an elusive problem where the last lines richtext from
one page get repeated at the top of the next page. Elusive because all
attempts at a simple example and the problem vanishes. It now looks like it
is related to setting the margins of the report.printersetup in the report
beforeprint event of a two-pass report.

Is there anything wrong with setting printersetup margin values in report
BeforePrint???

I want the user to set the paper size etc. in one place, and subsequently
apply it to all reports. Having the paper/page dimensions, where (if not in
BeforePrint) is the best place to apply it to every report they later use?

Meanwhile I'll try to pin down that example.

Sarah

Comments

  • edited September 2002
    The timing is too late to do it in the Report.BeforePrint event. Set this
    property after the report template is loaded. Use the
    Report.Template.OnLoadEnd public event.


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited September 2002
    Thank you, I am discovering that doing it in BeforePrint is a problem, but I
    don't use templates. I just have several reports on dynamically created
    forms. When report output needed the application creates the form, and hence
    report, prints it and then frees the form. Perhaps this is unauthodox, but
    templates weren't obvious when I started with RB and I have no requirement
    for user changes to the report (only the paper size) so I never got my head
    around templates, and I want to minimise GDI resource use too and not have
    external files associated with the deployed application.

    Anyway, where else can I set margins size other than when loading a
    template? And if I wanted to adjust paper or margin size from preview, how
    could I go about that? Slightly differernt from example #121.

    I have been using report.BeforePrint as a "good" place to initialise all
    kinds of things e.g. colour, widths etc. generally configure the report (I
    have a number of general designs which I adjust depending on their use). Now
    I am realising this may not be the best way to work. Can you advise?

    Sarah

  • edited September 2002
    The best chance to configure the printer setup is to create a singleton
    object that you can pass every report from your curretnly instantiated form
    to. This singleton would have been configured with the printer setup that
    that the user selected. This way, you can call this routine in every form,
    just before you call Report.Print in that form unit.


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.