Question
“How do I display a unique caption for each copy of my report?”
Solution
ReportBuilder 11 introduced two copy related options to the System Variable component. Placing this component on your report and setting it to CopyNo or CopyNoDesc will display the copy number on each separate copy of the report.
If more customization is needed, see the example below on manually creating unique captions for each copy of the report.
Download: UniqueCaptionForEachCopy.zip
Download: UniqueCaptionForEachCopyRAP.zip
Sample Delphi code:
procedure TForm1.ppReport1BeforePrint(Sender: TObject);
begin
FCopy := 0;
end;
procedure TForm1.ppReport1StartPage(Sender: TObject);
begin
if ppReport1.SecondPass and (ppReport1.AbsolutePageNo = 1) then
FCopy := FCopy + 1;
end;
procedure TForm1.ppPageStyle1BeforePrint(Sender: TObject);
begin
if (ppReport1.PrinterDevice = nil) then
begin
FCopy := 0;
ppLabel1.Visible := False;
end
else
begin
ppLabel1.Visible := True;
ppLabel1.Caption := 'Copy ' + IntToStr(FCopy); //or custom caption
end;
end;