How to get page numbers from report created in code?
I've created a report in code and it is working just fine. But how do I access the <Page> and <TotalPages> variables so that I can put them in the page footer?
Here is the basics of what I am trying to do which does not print any page numbers (see the .Text property near the bottom):
Thanks,
Dale
Here is the basics of what I am trying to do which does not print any page numbers (see the .Text property near the bottom):
Thanks,
Dale
procedure TReportsDlg.DoCustomReport1(const zShowAsPreview: boolean);
var
oReport: TfrxReport;
oPage: TfrxReportPage;
oReportTitle: TfrxReportTitle;
oPageHeader: TfrxPageHeader;
oMasterData: TfrxMasterData;
oPageFooter: TfrxPageFooter;
begin
{--- REPORT ---}
oReport := TfrxReport.Create(Self);
oReport.Clear;
oReport.DataSets.Add(frxMaster);
oReport.EngineOptions.DoublePass := True;
{--- PAGE ---}
oPage := TfrxReportPage.Create(oReport);
oPage.SetDefaults;
oPage.Orientation := lclPageOrientation(iOrientation);
{---- report title, page header and databand go here -----}
{--- Page Footer ---}
oPageFooter := TfrxPageFooter.Create(oPage);
oPageFooter.Height := 30;
oPageFooter.Width := 720;
{--page footer contents--}
with TfrxMemoView.Create(oPageFooter) do begin {Page nums}
CreateUniqueName;
Height := 20;
Text := 'Page ' + oReport.Variables['Page'] + ' of ' + oReport.Variables['TotalPages']; { <---- how to do this??? }
Width := 300;
end;
oReport.ShowReport;
end;
Comments
Text := 'Page ' + '[Page]' + ' of ' + '[TotalPages]';
Thanks,
Dale