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

Change Printing Attributes using a Dialog.

edited September 2003 in General
Hi There !

I want to know whether any body has a dialog which can change the various
attributes of the report before ppReport.Print.
Such as changing the fonts/font sizes in all the bands, paper sizes,
orientattion etc. Also I need to know whether it has a option to save the
changes for each report.

Thanks in Advance.

Thatchin
~~~~~~~~~~~~~~~~~~~~~

Comments

  • edited September 2003
    Hi Thatchin,

    Take a look at the Report Wizard in ReportBuilder for an example of creating
    a report with a dialog. You will want to create something similar to this
    and make sure it makes its updates in the Report.BeforePrint event. You can
    access the Report Wizard by selecting File | New in the Report Designer.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2003
    I think I was not clear in putting the question right !

    The user has nothing to do with the report's design, but I want him to have
    an option only to change the Such as changing the fonts/font sizes in all
    the bands, paper sizes, orientattion etc., before viewing/printing the
    report.

    Thanks in Advance

    Thatchin
    ~~~~~~~~~~~~~~~


  • edited September 2003
    Hi Thatchin,

    You will need to create a dialog that after giving all the options to the
    user, loops throught each object in your report and makes changes to them
    according to what the user has selected. You can do this by creating a
    Report Object Loop. Below is a small example of how this can be done. This
    example changes the font of every object in the report.

    ----------------------------------------------
    Tech Tip: Loop Thru All Objects in a Report
    ---------------------------------------------

    A ReportBuilder report is composed of a set
    of components. The basic structure is

    Reports.Bands[].Objects[]

    The bands and objects within the report can
    be accessed directly by object name or
    via the Bands and Objects array properties.

    Below is an example of using the Bands and
    Objects array properties to change the font for
    all objects on a report.


    uses
    ppClass;


    procedure AssignFontToReport(aFont: TFont; aReport: TppCustomReport);
    var
    liBand: Integer;
    liObject: Integer;
    lObject: TppComponent;

    begin

    for liBand := 0 to aReport.BandCount-1 do

    for liObject := 0 to aReport.Bands[liBand].ObjectCount-1 do
    begin
    lObject := aReport.Bands[liBand].Objects[liObject];

    if lObject.HasFont then
    lObject.Font := aFont;

    end;

    end;


    --
    Best Regards,

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