before print using delphi 7
I am trying to get a report to do a before print. i have a report unit that
is called when i want to view a report. when i view the report i want to do
a detail band before print. When i try to view the report it doesn't hit the
before print. it just goes straight to the rtm file. here is the code for
when i want it to print.
function declaration
var
PathName : String;
tempEcr : tEcrPrg;
DescTable : String;
RptForm : TfrmEcrRptCasio8500PLU;
begin
PathName := GetApplicationPath;
RptForm := TfrmEcrRptCasio8500PLU.Create(nil);
with RptForm do begin
if tblToUse.Active then
tblToUse.Active := false;
tblToUse.TableName := 'tEcrRptCasio8500PLU';
tblToUse.DatabaseName := GetReportPath(_Polling);
if tblToUse2.Active then
tblToUse2.Active := false;
tblToUse2.TableName := 'AllPolls';
tblToUse2.DatabaseName := GetReportPath(_Polling);
tblToUse.Active := true;
tblToUse2.Active := true;
ppReport1.Template.FileName := TemplateName;
ppReport1.Template.LoadFromFile;
ppReport1.ShowPrintDialog := True;
ppReport1.DeviceType := 'Screen';
ppReport1.Print;
The ppReport1.Print is where i assume that the detail band before print
should fire and it isn't. What should I do to get the before print to fire.
thanks.
is called when i want to view a report. when i view the report i want to do
a detail band before print. When i try to view the report it doesn't hit the
before print. it just goes straight to the rtm file. here is the code for
when i want it to print.
function declaration
var
PathName : String;
tempEcr : tEcrPrg;
DescTable : String;
RptForm : TfrmEcrRptCasio8500PLU;
begin
PathName := GetApplicationPath;
RptForm := TfrmEcrRptCasio8500PLU.Create(nil);
with RptForm do begin
if tblToUse.Active then
tblToUse.Active := false;
tblToUse.TableName := 'tEcrRptCasio8500PLU';
tblToUse.DatabaseName := GetReportPath(_Polling);
if tblToUse2.Active then
tblToUse2.Active := false;
tblToUse2.TableName := 'AllPolls';
tblToUse2.DatabaseName := GetReportPath(_Polling);
tblToUse.Active := true;
tblToUse2.Active := true;
ppReport1.Template.FileName := TemplateName;
ppReport1.Template.LoadFromFile;
ppReport1.ShowPrintDialog := True;
ppReport1.DeviceType := 'Screen';
ppReport1.Print;
The ppReport1.Print is where i assume that the detail band before print
should fire and it isn't. What should I do to get the before print to fire.
thanks.
This discussion has been closed.
Comments
Tech Tip: Working with Report Templates
----------------------------------------------
Whenever you save a template to an .rtm file, all of the published
properties of the Report are saved. This includes all Properties
and Events that are visible in the Object Inspector. For the events,
the 'name' of the event-handler procedure is saved.
When you load an .rtm all of the properties values of the TppReport
component are set to the values that were stored to the .rtm.
If you load an .rtm that had OnStartPage assigned then it will
be re-attached - provided that the event-handler method is a published
procedure of the report's owner. The Owner is normally the form.
On the other hand, if you load an .rtm that did NOT have OnStartPage
assigned
when it was saved, you will need to programmatically assign the
event-handler.
Example:
You have a form with an event-handler for OnStartPage...
type
Form1 = class(TForm)
procedure Form1StartPageEvent(Sender: TObject);
end;
You need to attach the event-handler after loading......
myReport.Template.LoadFromFile;
myReport.OnStartPage := Form1StartPageEvent;
--
Tech Support mailto:support@digital-metaphors.com
Digital Metaphors http://www.digital-metaphors.com
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com