Something for Version 7+ ?
Wouldn't it be great to have object oriented reports? I don't mean the RBPro
VCL (which is already OO) but the reports themselves. That way you could
write a suite of base class reports and implement your actual reports by
inheriting from a base class.
I often have to write a set of reports which are a variation on core design,
and like most people, I get one good report done, then save it with new
names to implement the variations. Then I find that my original report has
flaw, and all 10, 15 etc derived reports need amending. Now if I could just
fix up my base class report ...... ;-)
--
Paul Toms (mailto:paultoms@cix.co.uk)
This discussion has been closed.
Comments
designer at runtime to create new reports. See code below. Place the code
your would like in the constructor, then you can create reports based off of
this report in the designer at runtime.
You can use Form Inheritance. Do not place data pipelines in the ancestor
form with DataPipline.AutocreateFields set to true. You'll have to create
the fields on the datapipeline manually.
Use subreports and dynamic subreport loading with report templates. There
is an example of how to do this in your installed ..RBuilder\Demos\EndUser\
directory. You can have common header/footer bands for all reports by using
a subreport in each report which would load from a template, ie. company
logos...
Cheers,
Jim Bennett
Digital Metaphors
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ppComm, ppEndUsr, ppReport, ppCtrls;
type
TmyReport = class(TppReport)
public
constructor Create(aOwner: TComponent); override;
end;
TForm1 = class(TForm)
ppDesigner1: TppDesigner;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
FReport: TmyReport;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses
ppClass;
procedure TForm1.FormCreate(Sender: TObject);
begin
FReport := TmyReport.Create(Self);
ppDesigner1.Report := FReport;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
FReport.Free;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ppDesigner1.ShowModal;
end;
{ TmyReport }
constructor TmyReport.Create(aOwner: TComponent);
var
FLabel: TppLabel;
begin
inherited Create(aOwner);
CreateDefaultBands;
FLabel := TppLabel.Create(Self);
FLabel.Band := HeaderBand;
FLabel.Caption := 'Company Logo';
FLabel.Font.Color := clNavy;
FLabel.Font.Size := 12;
end;
initialization
RegisterClass(TmyReport);
finalization
UnRegisterClass(TmyReport);
end.
http://www.digital-metaphors.com
info@digital-metaphors.com
have, especially from an end user's standpoint. It is possible to replace
the new report dialog (all forms in RB are replaceable) and have it show
icons for different reports, and then load the template for the user behind
the scenes. Thanks for the suggestion.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com