How To…Repeat Labels

Question

“How can I print X number of labels for each record?”

Solution

This example shows how to use the DetailBand.BandsPerRecord property to print X number of labels for each record.

Download: RepeatLabels.zip

Sample Delphi code:

procedure TForm1.ppDetailBand1BeforePrint(Sender: TObject);
var
  liCount: Integer;
begin

  {check BandsPerRecordCount, it resets to 1 when all bands for the
      prior record have gemerated }
  if (ppDetailBand1.BandsPerRecordCount = 1) then
    begin
      liCount := Round(ppReport1.DataPipeline['CustNo'] div 1000);

      ppDetailBand1.BandsPerRecord := liCount;
    end;

  // show a counter next to each label
  ppLabel4.Caption := IntToStr(ppDetailBand1.BandsPerRecordCount);

end;